Scala project skeleton using SBT
Let's create a minimal scala project skeleton, based on SBT build system, with some SBT plugins enabled (eclipse and assembly). The goal is to generate a single standalone executable jar (without any external dependencies), using scala language (and/or java) and eclipse as an optional IDE.
The scala project skeleton is available as a google code project. visit : scala-dummy-project or checkout the project :
- JVM >= 1.5 available in your PATH
- get and install SBT (Simple Build Tool)
- if you want to use eclipse, download and install Scala IDE for eclipse
To use eclipse, you must initialize the project for eclipse, run "sbt eclipse" or just "eclipse" from SBT console.
All steps :
CONTEXT : Scala 2.9.1 / SBT 0.11 / ScalaTest 1.6.1 / sbt-assembly 0.7.2 / sbteclipse 1.5.0
The scala project skeleton is available as a google code project. visit : scala-dummy-project or checkout the project :
Requirements are :
# Quick start
$ git clone git://github.com/dacr/scala-dummy-project.git
$ cd scala-dummy-project
$ sbt assembly
$ java -jar target/dummy.jar
Hello userX
- JVM >= 1.5 available in your PATH
- get and install SBT (Simple Build Tool)
- if you want to use eclipse, download and install Scala IDE for eclipse
To use eclipse, you must initialize the project for eclipse, run "sbt eclipse" or just "eclipse" from SBT console.
All steps :
The project is configured as follow :
$ cd scala-dummy-project
$ sbt
> eclipse
> run
> test
> assembly
> exit
$ java -jar target/dummy.jar
#OR
$ sbt run
What's great with sbt is that it manages all dependencies for you (even sub-dependencies !), no need to download anything, everything is done automatically.
import AssemblyKeys._
seq(assemblySettings: _*)
name := "ScalaDummyProject"
version := "0.1"
scalaVersion := "2.9.1"
mainClass in assembly := Some("dummy.Dummy")
jarName in assembly := "dummy.jar"
libraryDependencies += "org.scalatest" %% "scalatest" % "1.6.1" % "test"
// Junit is just required for eclipse to be able to start tests.
libraryDependencies += "junit" % "junit" % "4.10" % "test"
CONTEXT : Scala 2.9.1 / SBT 0.11 / ScalaTest 1.6.1 / sbt-assembly 0.7.2 / sbteclipse 1.5.0