I'm configuring our CI infrastructure and when project loading fails sbt asks what to do:
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
This hangs the build which waits for process to return.
Is there a way to tell sbt to stop without asking what to do when loading fails?
Invoke SBT with the -batch
option. It will still print the prompt but not actually wait for a reply, instead it will exit with a non-0 status.
IMHO patching the sbt launcher, so the sbt
executable, is acceptable only if it has to be done once, ie on a single CI box or on your devenv.
Instead as a trick you can close the stdin on the sbt command:
sbt < /dev/null
and by doing so interactive mode will not be enabled, causing it to exit in case of errors.
See here for a rather similar question.
Disable the underlying JLine terminal type via a JVM argument
-Djline.terminal=off
and SBT will be unable to prompt you, and simply exit.
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