I've recently fought to get a simple project created using sbt and imported in to eclipse using sbt eclipsify. Unfortunately, being so new to these tools, I struggled a bit. Below is a summary of how I achieved it.
- Download SBT and get it running... this is pretty simple and the directions located here explain it very well.
- Now that you have SBT downloaded and setup, it is runnable from the command line in any directory. Navigate to where your eclipse projects are normally kept, in my case
- So now you have it, a project created using SBT sitting on your file system. Well done. Now the tricky part, using Eclipsify to get it into Eclipse.
- I downloaded Eclipsify from here, then extracted the zip on to my filesystem. In the unzipped file system, I navigated to "musk-SbtEclipsify-ca279bd/dist" and coppied the file "sbteclipsify-0.4.0.jar" from there to a new folder I created in "Concepts\project\plugins" where concepts is the directory created above.
- Now create a Scala file in the concepts directory called "Plugins.scala" as follows
- Next, create a file called Concepts.scala in Concepts\project\build
- Now in your command line window (running sbt) run this command
- This should have created an eclipse command that can be used in the SBT console
- Now go to Eclipse and import your project! The files you need have been generated.
D:\>cd D:\development\workspace D:\development\workspace>mkdir Concepts D:\development\workspace>cd Concepts D:\development\workspace\Concepts>sbt D:\development\workspace\Concepts>set SCRIPT_DIR=D:\cory\sbt\ D:\development\workspace\Concepts>java -Xmx512M -jar "D:\cory\sbt\sbt-launch-0.7.4.jar" Project does not exist, create new project? (y/N/s) y Name: Concepts Organization: Maksymchuk Version [1.0]: Scala version [2.7.7]: sbt version [0.7.4]: Getting Scala 2.7.7 ... :: retrieving :: org.scala-tools.sbt#boot-scala confs: [default] 2 artifacts copied, 0 already retrieved (9911kB/593ms) Getting org.scala-tools.sbt sbt_2.7.7 0.7.4 ... :: retrieving :: org.scala-tools.sbt#boot-app confs: [default] 15 artifacts copied, 0 already retrieved (4096kB/719ms) [success] Successfully initialized directory structure. [info] Building project Concepts 1.0 against Scala 2.7.7 [info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7 >
import sbt._ class Plugins(info: ProjectInfo) extends PluginDefinition(info) { val a = "de.element34" % "sbt-eclipsify" % "0.7.0" }
import sbt._ import de.element34.sbteclipsify._ class Concepts(info: ProjectInfo) extends DefaultProject(info) with Eclipsify { // the project definition here }
> reload
> eclipse