Showing posts with label lift. Show all posts
Showing posts with label lift. Show all posts

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 "http://siasia.github.com/maven2"
    
    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.