Simple SBT use case
Simple Build Tool (sbt) is an impressive tool, building is really fast, and configuration quite simple in particular with small projects. No need to learn a new language, as sbt configuration is made using scala ! Of course automatic dependencies resolution is available !
Consider the following simple project, naturalsort.tar.gz, whose file hierarchy is the following :
"build.sbt" just contains :
Once sbt is setup, just enter "naturalsort" directory, and run sbt; it will resolve dependencies, and make the sbt console available for you :
CONTEXT : Linux Gentoo / Scala 2.9.0 / Java 1.6.0_26 / SBT 0.10 / ScalaTest 1.6.1
Consider the following simple project, naturalsort.tar.gz, whose file hierarchy is the following :
naturalsort/
naturalsort/build.sbt
naturalsort/src/main/scala/naturalsort/NaturalSort.scala
naturalsort/src/test/scala/naturalsort/NaturalSortTest.scala
"build.sbt" just contains :
name := "NaturalSort"
version := "1.0"
scalaVersion := "2.9.0"
libraryDependencies += "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test"
Once sbt is setup, just enter "naturalsort" directory, and run sbt; it will resolve dependencies, and make the sbt console available for you :
$ cd naturalsort/
$ sbt
> compile
[info] Updating {file:/home/dcr/dev/naturalsort/}default-76224f...
[info] Done updating.
[info] Compiling 1 Scala source to /home/dcr/dev/naturalsort/target/scala-2.9.0.final/classes...
[success] Total time: 6 s, completed 22 août 2011 22:21:14
> test
[info] Compiling 1 Scala source to /home/dcr/dev/naturalsort/target/scala-2.9.0.final/test-classes...
[info] NaturalSortTest:
[info] - basic tests
[info] - advanced tests
[info] - special cases tests *** FAILED ***
[info] List(1.1, 1.002, 1.3, 1.010) did not equal List(1.001, 1.002, 1.010, 1.02, 1.1, 1.3) (NaturalSortTest.scala:37)
[error] Failed: : Total 3, Failed 1, Errors 0, Passed 2, Skipped 0
[error] Failed tests:
[error] naturalsort.NaturalSortTest
[error] {file:/home/dcr/dev/naturalsort/}default-76224f/test:test: Tests unsuccessful
[error] Total time: 4 s, completed 22 août 2011 22:21:35
> ~compile
[success] Total time: 0 s, completed 22 août 2011 22:23:02
1. Waiting for source changes... (press enter to interrupt)
> ~ test-only naturalsort.NaturalSortTest
[info] Compiling 1 Scala source to /home/dcr/dev/naturalsort/target/scala-2.9.0.final/test-classes...
[info] NaturalSortTest:
[info] - extreme tests
...
> package
[info] Packaging /home/dcr/dev/naturalsort/target/scala-2.9.0.final/naturalsort_2.9.0-1.0.jar ...
[info] Done packaging.
[success] Total time: 0 s, completed 4 sept. 2011 10:55:24
CONTEXT : Linux Gentoo / Scala 2.9.0 / Java 1.6.0_26 / SBT 0.10 / ScalaTest 1.6.1