dsg dsg - 1 year ago 64
Scala Question

Create Simple Project SBT 0.10.X

(This is a follow up to sbt not creating projects correctly. The question wasn't answered.)

Basically, that question says "I don't know how to create a project under the new sbt. With the old one, I just ran
in a new folder and there was a guided wizard that led me through the setup."

The accepted answer does not explain how to create a new project, it just points to the documentation, which also doesn't explicitly say how to create a new project -- only how to write a

So I tried first writing a
and then running
in the directory with the
file, but I still don't see a
directory to work with.

Could someone post a simple step-by-step (I'm assuming there are like 3 steps at most) guiding how to create a new project under sbt 0.10.X?

dsg dsg
Answer Source

I found the answer I was looking for at this webpage: Scala 2.9.1, sbt 0.10 and ScalaTest step-by-step.

The high-level steps are:

  1. mkdir my_project make a folder for your project
  2. Create a simple my_project/build.sbt file, e.g.:

    name := "A Project"
    version := "0.1"
    scalaVersion := "2.9.1"
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "1.6.1" % "test"
  3. Create a file my_project/src/main/scala/HelloWorld.scala, where you create all the directories you need as you go (e.g. create the directory structure src/main/scala/)

    object Main extends App { Console.println("Hello World!") }

  4. Execute your sbt commands: e.g. sbt run

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download