Sbt
From Knowitall
SBT is a build system for Scala/Java. Many of our projects use it now. You can get sample build files from our projects.
SBT Eclipse is a plugin for SBT that creates Eclipse projects for you based on your build. After setting it up, you just go to the root folder of any sbt project and type: sbt eclipse
. Then, from within Eclipse, you "import an existing Eclipse project."
Useful commands for sbt are:
-
sbt compile
, for compiling, of course. -
sbt test
, which builds and runs tests. -
sbt 'run arg1 arg2 ...'
to run code. If there's more than one main class, it will prompt you to select a number for which one. You can automate this by just passing in the number through standard input, i.e.,echo 2 | sbt 'run arg1 arg2 ...'
-
sbt publish-local
, which is likemvn install
. It saves the artifacts from the current project into a local Ivy repository, which other projects can use. -
sbt clean
for when you want to clean your project.
You can also run sbt in interactive mode by just typing sbt
. One helpful command is ~ compile
, which recompiles your code whenever you save a file.