Keros
Keros

Reputation: 363

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?

Upvotes: 8

Views: 2112

Answers (3)

reim
reim

Reputation: 612

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.

Upvotes: 3

Brian Agnew
Brian Agnew

Reputation: 272337

Disable the underlying JLine terminal type via a JVM argument

-Djline.terminal=off

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

Upvotes: 1

Randall Schulz
Randall Schulz

Reputation: 26486

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.

Upvotes: 9

Related Questions