Jenkins 2.0: Running SBT in a docker container

So after long and tedious searches what finally worked for me is setting explicitly the .sbt and .ivy2 folder like this inside the docker container:

sbt -Dsbt.global.base=.sbt -Dsbt.boot.directory=.sbt -Dsbt.ivy.home=.ivy2 clean test

That somehow prevents sbt from generating the ? folder and directly puts the aforementioned folders in the root of the directory checkout.


I spent a lot of time tracing this down through the code.

It looks like the easiest solution is to just pass -Duser.home=<path> to sbt, or to set it in the SBT_OPTS environment variable; then all the rest of the directories will be built as if the <path> is the user's home directory.