SBT and Intellij – May 2016
There are tricks to speed it up, which are all well documented, this is my notes page, for me
http://www.scala-sbt.org/release/docs/Dependency-Management-Flow.html
Intellij
Environment variables for SBT are held in the sbtconfig.txt file, so for instance you might do this in sbtconfig.txt:
Note that if you get the StackOverflowException during SBT compile then you need to add the -Xss5M (or whatever value you want).
-Xmx518 -XX:MaxPermSize=128m -Xss5M -Dsbt.log.format=true -Dhttps.proxyHost=proxy.yourco.com -Dhttps.proxyPort=1234 -Dhttps.proxyUser=yourname -Dhttps.proxyPassword=yourpassword -Dhttp.proxyHost=proxy.yourco.com -Dhttp.proxyPort=1234 -Dhttp.proxyUser=yourname -Dhttp.proxyPassword=yourpassword -Dhttp.nonProxyHosts=*.localdomain.com -Dsbt.ivy.home=C:\dev\buildstuff\apache-ivy-2.4.0\ -Divy.home=C:\dev\buildstuff\apache-ivy-2.4.0\ -Dsbt.dir=C:\dev\buildstuff\.sbt -Dsbt.boot.directory=C:\dev\buildstuff\.sbt\boot -Dsbt.globbal.base=C:\dev\buildstuff\.sbt
So, to make IntelliJ do the same, you open up menu->file->settings->Build, Execution, Deployment->Build Tools->SBT. Then change the launcher to be the one you have installed, and change the VM parameters - click on the little box to the right and cut and paste the contents of your sbtconfig.txt into that box.
To speed up SBT
Edit C:\dev\buildstuff.sbt\0.13\global.sbt add: offline := true
Alternatively you can just type that when running SBT interactively
sbt set offline := true
This avoids going to remote ivy resoluton for snapshots.
Then you can do sbt update on its own and it will still resolve snapshots remotely
Turn off resolution
To totally turn off resolution, even when using sbt update, use
skip in update := true</br>
Note I’ve never done that, so no idea where or when you put it.
Cached resolution
SBT know that devs hate the time dependency resolution can take on large multi-project projects, so they are working on it (still)
http://www.scala-sbt.org/0.13/docs/Cached-Resolution.html
Works by storing mini dependency graphs at:
~/.sbt/0.13/dependency/
updateOptions := updateOptions.value.withConsolidatedResolution(true)
You are not alone
Alot of people are also hacked off with SBT and Ivy, for a long time: https://github.com/sbt/sbt/issues/413