As an sbt build can be written in scala and is itself a scala project, i would like to import it in scala-ide as a scala project. For example with the following code.
Build.scala
import sbt._
import Keys._
object TestBuild extends Build {
lazy val root = Project(id = "test",
base = file("."),
settings = Seq(
organization := "com.tomahna",
name := "demo",
scalaVersion := "2.11.8"))
}
plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
This build works fine with sbt, however Build.scala is not compiled by eclipse, thus i get neither compilation errors nor auto-completion.
I can add the project folder to source folders but then import sbt._
and import Keys._
will fail because the eclipse project is not correctly set to provide these dependencies.
Is there a way to setup the sbt project so that it interact nicely with scala-IDE ?
From sbteclipse manual:link
If you want to get Eclipse support for the sbt build definition, e.g. for your Build.scala file, follow these steps:
If you are not using sbteclipse as as global plugin, which is the recommended way, but as a local plugin for your project, you first have to add sbteclipse as a plugin (addSbtPlugin(...)) to the build definition project, i.e. to project/project/plugins.sbt
In the sbt session, execute reload plugins
Set the name of the build definition project to something meaningful: set name := "sbt-build"
Execute eclipse and then reload return
Import the build definition project into Eclipse and add the root directory to the build path