Reputation: 6543
Last week we had the user directory permissions changed on our CI servers and we no longer have write access to the user home directory. Hence sbt fails to boot because it cannot write to ~/.ivy
etc with the following stacktrace.
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1006)
at xsbt.boot.Locks$.apply0(Locks.scala:34)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at xsbt.boot.Launch.locked(Launch.scala:238)
at xsbt.boot.Launch.app(Launch.scala:147)
at xsbt.boot.Launch.app(Launch.scala:145)
at xsbt.boot.Launch$.run(Launch.scala:102)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.io.IOException: No such file or directory
I know that there is a smattering of sbt variables we can set, such as the boot directory. I've not yet found a definitive list of all the variables that we can configure that otherwise default to a subdirectory of user home. I also have not found a way to set the default root directory, which could in turn impact all of these variables.
Can anyone point out how to configure sbt such that it does not use the user's home directory for any files?
Upvotes: 6
Views: 3803
Reputation: 6543
The ivy path options mentioned in the other answers here were part of the solution. As pointed out in this answer you need to set ivy for both sbt itself and the project. Furthermore as I discovered on this sbt github issue comment, sbt needs yet another directory for its own stuff.
In total, I used the following three jvm properties in order to use a relative path to the project for everything that sbt otherwise uses the user's home directory for:
-Dsbt.global.base=./.sbt/
-Dsbt.ivy.home=./.ivy2/
-Divy.home=./.ivy2/
At least as of sbt 0.13.9, this is what is needed.
Upvotes: 6
Reputation: 10328
You can set -ivy
when using sbt-extras (preferable), or you can use a JVM property:
-Dsbt.ivy.home=/path/to/ivy
I've also used this:
-Divy.default.ivy.user.dir=/path/to/ivy
Upvotes: 3
Reputation: 497
If you would like to run with your .ivy in a different location, and you're using sbt extras boot script, then you should just be able to do:
sbt -ivy /path/to/ivy package
and it'll download all the ivy stuffs to the location specified and run whatever command you need (in this example, package
)
Upvotes: 5