by Heiko Seeberger

Recently the revamped version 0.10 of the Simple Build Tool (sbt) was released. We are also closing in on a final 2.0.0 release of the Scala IDE for Eclipse that will hopefully bring the age of limited IDE support for Scala to an end. Having these two great tools at hand, we certainly need integration capabilities. The sbteclipse project aims at that very goal by providing a plugin for sbt that makes it possible to create Eclipse project files from an sbt project.

The current version 1.1 of sbteclipse, which requires sbt 0.10 or later, provides the additional sbt command eclipse which automatically creates Eclipse .project and .classpath files. Using the optional argument create-src will additionally create the source folders of the sbt project, e.g. src/main/scala. Of course this also works for multi-module projects. In such a case the root project often is just a folder and not a “proper” project. Therefore the optional argument skip-root can be given to prevent the Eclipse project files for the root project from being created.

As soon as the Eclipse project files are in place, the “Import...” wizard of Eclipse can be used to import “existing projects into workspace”. It is strongly recommended not to copy these projects into the workspace, i.e. simply leave the relevant checkbox unchecked. Otherwise the projects will be duplicated and possibly diverge on the long run.

In order to “install” sbteclipse as a general plugin which is available to all sbt projects, the following build.sbt file has to be created in the directory ~/.sbt/plugins:

resolvers += {
  val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases")
  val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]")
  Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern)
}

libraryDependencies <<= (libraryDependencies, sbtVersion) { (deps, version) => 
  deps :+ ("com.typesafe.sbteclipse" %% "sbteclipse" % "1.1" extra("sbtversion" -> version))
}

We hope that you find sbteclipse helpful and are looking forward to your comments. Please report any issues or enhancement requests via the project’s issue tracker.

Share


Discuss


View All Posts or Filter By Tag


Ebook

Designing Reactive Systems: The Role Of Actors In Distributed Architecture

by Hugh McKee

Ebook

Fast Data Architectures For Streaming Applications

by Dean Wampler

Ebook

Reactive Microservices Architecture

by Jonas Bonér

Ebook

Developing Reactive Microservices

by Markus Eisele

Report

Enterprise Development Trends 2016

Cloud, Container and Microservices Insights from 2100 JVM Developers

Infoguide

Lightbend Reactive Platform

A High-Level Technical Overview For Decision Makers