I'm new to SBT and am unsure how to get a project started. Can someone point me to a beginner's guide to creating a Hello World type project, or give me some clues?
My preferred IDE is IDEA. I have run sbt-idea
according to the instruction on the IDEA Plugins page. At the moment I'm a bit confused because
scalaVersion := "2.9.0"
in the build.sbt
file? This means IDEA doesn't recognize object HelloWorld extends App {}
.Thanks.
This worked for me:
First get sbt and the gen-idea plugin going...
sbt
command. This should download the scala libraries and create a 'project' and 'target' directories.Create a new file 'build.sbt' in this directory with the following lines, as described on the sbt-idea plugin Github wiki:
resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")
Change back to your main project directory such as ~/myCode/myNewProject. Run sbt
. It should download the gen-idea plugin.
gen-idea
command. It should create the IDEA project directories. For me, it also emits copious warnings.Now get the IDEA SBT console plugin going...
Make up a new 'build.sbt' file and put it in ~/myCode/myProject (or whatever you called it). Since I am just figuring out sbt, mine is simple so far - just nominates scalatest as a dependency and uses Scala 2.9:
name := "myProject"
version := "0.1"
organization := "me"
libraryDependencies += "org.scalatest" % "scalatest_2.9.0" % "1.6.1"
scalaVersion := "2.9.0"
Enter the reload
command in the SBT console at the bottom of the IDEA screen. It should download scalatest and Scala 2.9 for you. Maybe you need to run 'update' too.