Developing Lift using Eclipse and the Scala Ide

This is a quick intro to developing Lift (the framework, not applications using Lift). Mostly useful for people wishing to work with the code base (like committers).

Just to reiterate: This is not for developing Lift applications. If you need to navigate the Lift source code (highly recommended btw!), have your build tool of choice download the source jars and attach them to the Lift jars in your project.

Updated 7. mar: Added section about user.sbt to specify settings for sbt eclipse.

Getting the Lift source

This is the easiest part:

$ git clone git://


Configuring SBT

Thanks to the hard work of Indrajit, Lift is now built using SBT 0.12. Thus, the sbteclipse plugin can be used to generate Eclipse project files from the SBT project definitions.

In order not to change any of the build files inside the Lift code, I’ve added the plugin definitions to the file ~/.sbt/plugins/build.sbt. This makes the eclipse command available to all my SBT projects,

resolvers += Classpaths.typesafeSnapshots

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-SNAPSHOT")

A few notes: The sbteclipse plugin for sbt 0.12-M1 is in the snapshot repo, so we need to add this as well.

Thanks to Richard, I found out you can specify options to the sbteclipse plugin in the file ~/.sbt/user.sbt (Yes I’m a SBT noob!). We need this to add the resource folders to the build path. And as mentioned by lkuczera in the comments below, it might be handy to also attach the source code to the referenced libraries.

EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource

EclipseKeys.withSource := true

Importing into Eclipse

Everything should be set now, so startup liftsh, the sbt wrapper used by Lift. This should look something like this (after a while :-)):

cd framework/
[info] Loading global plugins from /Users/jeppe/.sbt/plugins
[info] Loading project definition from /Users/jeppe/projects/blog/framework/project/project
[info] Updating {file:/Users/jeppe/projects/blog/framework/project/project/}default-0f93ec...
[info] Resolving default#default-30f1b5;0.0 ...
[info] Resolving com.typesafe.sbteclipse#sbteclipse-plugin;2.1.0-SNAPSHOT ...
[info] Resolving com.typesafe.sbteclipse#sbteclipse-core;2.1.0-SNAPSHOT ...
[info] Done updating.
[info] Compiling 3 Scala sources to /Users/jeppe/projects/blog/framework/project/target/scala-2.9.1/sbt-0.12/classes...
[info] Set current project to Lift Framework (in build file:/Users/jeppe/projects/blog/framework/)

Now, generate the Eclipse projects:

sbt:lift-framework:2.5-SNAPSHOT> eclipse
[info] About to create Eclipse project files for your project(s).
[info] Successfully created Eclipse project files for project(s): Lift Webkit, Lift Json, Lift Actor, Lift Json Ext, Lift Mongodb Record, Lift Mongodb, Lift Record, Lift Wizard, Lift Ldap, Lift Proto, Lift Squeryl Record, Lift Mapper, Lift Common, Lift Jpa, Lift Db, Lift Json Scalaz, Lift Util, Lift Testkit, Lift Couchdb

Start up Eclipse and import the needed projects into an Eclipse workspace (the Scala Plugin should already be installed). Go hack in the Lift code and contribute great stuff!

A few issues

  • It seems you need all the dependent Lift projects in Eclipse, you cannot mix and match between source & binary dependencies.
  • “Webkit” uses code from “Testkit” but this project dependency is not generated. Not sure why yet, but I’ve added the “Testkit” project as dependency to “Webkit” and this seems to work.
  • When I build everything I get a compilation error in I think this is related to the differences between javac, and ejc (the Eclipse Java Compiler). Since I don’t care for java here, I simply exclude SiteMapJ from compilation.
  • I cannot run the tests using the JUnit runner. I think this is a combination of the way the specs are declared in Lift and issues with the Scala Ide. I can run the specs as a Scala Application though.

5 responses to this post.

  1. Regarding running your tests, have you added the @RunWith(classOf[JUnitRunner]) annotation? It’s documented here:


    • Posted by Jeppe on March 6, 2012 at 18:55

      Yes I know about it, but didn’t want to go through all the Lift source and change how the specs are declared 🙂 Also not sure how changing the specs declaration would affect others not using Eclipse. But thanks for the heads up.


  2. I recommend using:
    eclipse with-sources
    You get all the source jars as well


    • Posted by Jeppe on March 6, 2012 at 23:55

      Good point. It seems I also need to add the resources folder as a srcPath. Do you know if this is available as an option as well?


      • Jeppe,

        I’ve got this in my ~/.sbt/global.sbt file

        EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource

        Which adds src/main/resources to the generated .classpath. Unfortunately it also seems to add src/main/java and src/test/java as well, but I can live with that.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: