Wednesday, June 8, 2011

Migrating to sbt 0.10: Lift

The latest release of sbt (version 0.10) is utterly incompatible with build scripts from older versions of SBT. Here's how to migrate a Lift project to SBT 0.10 (these instructions work with 2.4-M1; I believe you can use earlier versions of lift, as long as you downgrade scalaVersion to 2.8.1):

  1. Rename project/ to project-old/
  2. Create a new build.sbt file in the root of your project

    name := "projname"
    scalaVersion := "2.9.0"
    seq(WebPlugin.webSettings: _*)
    libraryDependencies ++= Seq(
      "net.liftweb" %% "lift-webkit" % "2.4-M1" % "compile->default",
      "net.liftweb" %% "lift-mapper" % "2.4-M1" % "compile->default",
      "net.liftweb" %% "lift-wizard" % "2.4-M1" % "compile->default")
    libraryDependencies ++= Seq(
      "junit" % "junit" % "4.5" % "test->default",
      "org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty",
      "javax.servlet" % "servlet-api" % "2.5" % "provided->default",
      "com.h2database" % "h2" % "1.2.138",
      "ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default"
  3. mkdir -p project/plugins
  4. Create a new file project/plugins/build.sbt and put the following in it:
    resolvers += "Web plugin repo" at ""
    libraryDependencies <+= sbtVersion("com.github.siasia" %% "xsbt-web-plugin" % _)

Now you're good to go.

Note that the Jetty dependency has changed. If you execute jetty-run and no output appears, make sure you changed the scope for the Jetty dependency from "test" (the correct value in older SBT's) to "jetty".

Also note that the new SBT parser appears to be newline-sensitive; make sure you keep blank lines between each setting, as in the example above.


  1. This is better than it.

    libraryDependencies ++= {
    val liftVersion = "2.4-M1"
      "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
      "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
      "net.liftweb" %% "lift-wizard" % liftVersion % "compile->default")

  2. Thanks a lot for this. The "jetty" scope was the last thing blocking me, and I didn't see it mentioned elsewhere. Cheers!

  3. i currently get an error on sbt start:

    [warn] ::::::::::::::::::::::::::::::::::::::::::::::
    [warn] ::::::::::::::::::::::::::::::::::::::::::::::
    [warn] :: com.github.mpeltonen#sbt-idea_2.8.1;0.10.0-SNAPSHOT: not found
    [warn] :: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found
    [warn] ::::::::::::::::::::::::::::::::::::::::::::::

    probably because both pages:
    are not existing ?

  4. Nyxos, see this post to resolve that error:

  5. Hi, Google lost my comment after letting me log in... :-(

    I am new to Lift and I am not migrating from old version of sbt to the new one.

    Here are what I did:
    - downloaded Lift 2.4-M4.
    - downloaded sbt.
    - ran sbt.
    - went to '/scala_29'
    - ran 'sbt update ~jetty-run'

    The sbt did not recognize '~jetty-run'. I googled and found your post.

    I made what all you described, then ran 'sbt update ~jetty-run' again. I got this error:

    $../scala_29/build.sbt:5: error: not found: value WebPlugin
    seq(WebPlugin.webSettings: _*)
    [error] Type error in expression
    Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

    Would you please help me?

    I thank you in advance.

    Best regards,
    Hai Le