SBT - Simple Build Tool Scala How To Set Up Eclipse Projects

Do you like this?

Summary:
This short tutorial shows you the basic steps to set up an Eclipse project with SBT Scala


Content:

Please make sure you have got scala and sbt set up before proceeding. In this example, we are going to create a hello world application using scala and sbt.
1) create a file plugins.sbt under
a) <User_Home>\.sbt\0.13\plugins OR
b) <Project_Dir>\project

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
2) mkdir helloworld
3) cd helloworld
4) create a file build.sbt
name := "Hello World"
 
version := "1.0"
 
scalaVersion := "2.10.1"
 
sbtVersion := "0.12.3"

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"
5) in the folder helloworld, run the following commands
sbt
eclipse
6) Import the project to eclipse
7) Every time you add new dependencies, remember to run sbt eclipse so that the libraries references in eclipse settings are updated accordingly.

 
comments powered by Disqus