I'm using SBT 0.10.0 to compile a combination of Java and Scala files. When I run the program through sbt run
it returns a nonzero error but doesn't show me a stacktrace -- it simply fails silently with the cryptic message:
Nonzero exit code: 1
If I run the program through scala
command line, it does show the stacktrace.
Is there any way I can get SBT to print out the entire stacktrace?
Using printStackTrace() method − It print the name of the exception, description and complete stack trace including the line where exception occurred. Using toString() method − It prints the name and description of the exception. Using getMessage() method − Mostly used. It prints the description of the exception.
Execute sbt
to get into the sbt shell, then try run
followed by last run
.
last <command>
outputs everything that the command produced (all log levels, including [debug]) and stacktraces.
last run
, as shown here, is the way to go, but it can be annoying if you are doing something like running in a loop with ~ run
and just want to see your app's exceptions. You can tell SBT to enable printing the stack traces automatically for a task like this:
traceLevel in run := 0
Further reference here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With