I just want to create a directory layout for my scala project with sbt and sbteclipse. Following is my sbt file.
import com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys
name := "BGS"
organization := "com.example"
version := "1.0.0"
scalaVersion := "2.9.2"
scalacOptions ++= Seq("-deprecation")
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource
EclipseKeys.projectFlavor := EclipseProjectFlavor.Scala
scalaSource in Compile <<= (sourceDirectory in Compile)(_ / "scala")
scalaSource in Test <<= (sourceDirectory in Test)(_ / "scala")
libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % "test"
libraryDependencies += "junit" % "junit" % "4.10" % "test"
unmanagedBase <<= baseDirectory { base => base / "lib" }
unmanagedJars in Compile <<= baseDirectory map { base => (base ** "*.jar").classpath }
In this sbt file, I had to use folling to lines to force creation of Scala directories:
scalaSource in Compile <<= (sourceDirectory in Compile)(_ / "scala")
scalaSource in Test <<= (sourceDirectory in Test)(_ / "scala")
Furthermore, after running “eclipse” from sbt console, I imported the project to Eclipse, but I could not create Scala class. Eclipse project icon has “J” letter attached to it indicating it is a Java project π
Why does sbt and sbteclipse default to Java?
I am running sbt version 0.12 (latest version as of Nov 2012), scala 2.9.2
For your information, what I am aiming to do is use sbt to create working project with following directory structure:
βββ build.sbt
βββ lib
βΒ Β βββ biojava3-core-3.0.4.jar
βββ project
βΒ Β βββ plugins.sbt
βΒ Β βββ project
βΒ Β βΒ Β βββ target
βΒ Β βββ target
βΒ Β βββ config-classes
βΒ Β βββ scala-2.9.2
βΒ Β βββ streams
βββ src
βΒ Β βββ main
βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βββ resources
βΒ Β βΒ Β βββ scala
βΒ Β βββ test
βΒ Β βββ java
βΒ Β βββ resources
βΒ Β βββ scala
βββ target
βΒ Β βββ scala-2.9.2
βΒ Β βΒ Β βββ cache
βΒ Β βΒ Β βββ classes
βΒ Β βΒ Β βββ test-classes
βΒ Β βββ streams
βΒ Β βββ compile
βββ test
Since I haven’t got any desirable answers so far, I am trending into Typesafe Stack. I removed manually-installed scala and sbt and I am using everything from Typesafe Stack. I will update more when I am done testing with this way.
Here is the final update as I promised:
I followed instruction in this link and it worked perfectly:
http://typesafe.com/resources/typesafe-stack/downloading-installing.html
Detailed information in case somebody want to follow for Mac OSX:
Basically, I first I switched macport to homebrew following instruction here:
Then I did:
Then create a Scala project from command line:
Finally I followed instruction here to add sbteclipse and convert the project to eclipse:
Everything works as I expect.