Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have sbt fail when project loading fails (rather than awaiting user input)?

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?

like image 934
Keros Avatar asked Jan 31 '14 15:01

Keros


3 Answers

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.

like image 52
Randall Schulz Avatar answered Nov 09 '22 19:11

Randall Schulz


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.

like image 35
reim Avatar answered Nov 09 '22 21:11

reim


Disable the underlying JLine terminal type via a JVM argument

-Djline.terminal=off

and SBT will be unable to prompt you, and simply exit.

like image 30
Brian Agnew Avatar answered Nov 09 '22 21:11

Brian Agnew