Most OSes have packages now, but if you must…
curl -O http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.5/sbt-launch.jar
echo 'SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"' > sbt
echo 'java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"' >> sbt
chmod u+x sbt
Specify each task’s “phrase” as an argument:
sbt "task1" "my task 2" ...
Examples:
sbt "project core" "dependency-graph"
sbt "project dsl" "clean" "~ compile"
Add to project/plugins.sbt
:
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
Add to build.sbt
:
net.virtualvoid.sbt.graph.Plugin.graphSettings
Run:
sbt dependency-graph
Output is similar to mvn dependency:tree
.
http://www.scala-sbt.org/release/docs/Global-Settings.html
$HOME/.sbt/0.13/*.sbt
settings that apply to all projects
$HOME/.sbt/0.13/plugins/
acts as global plugin project
Let’s enable the dependency-graph task globally…
$HOME/.sbt/0.13/plugins/build.sbt
:
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
$HOME/.sbt/0.13/global.sbt
:
Seq(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*)
sbt 0.13.5 (latest release and preview of 1.0) introduces auto plugins.
addSbtPlugin()
in project/plugins.sbt
.$ du -sh ~/.m2/repository ~/.ivy2/cache/
3.1G /home/brad/.m2/repository
1.5G /home/brad/.ivy2/cache/
Tell sbt to check your local Maven repo for artifacts with:
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
or in recent versions of sbt:
resolvers += Resolver.mavenLocal
(Much Improved) Documentation: http://www.scala-sbt.org/documentation.html
Good advice from @jsuereth: http://jsuereth.com/scala/2013/06/11/effective-sbt.html
Complex sbt project that’s probably written the Right Way™: https://github.com/akka/akka/tree/master/project