Scala Lift simple build tool – sbt Cheat Sheet


This Cheat Sheet assumes that

a) you have a basic understanding of java platform, maven build tool and IntelliJ IDEA.

b) you use windows platform for development

c) you use IntelliJ IDEA v9, java v1.6+, maven v2.2.1, git v1.7.1.1, scala v2.7.7, lift v2.0 and simple build tool v0.7.4

Install Java, maven, Git, IntelliJ IDEA and simple build tool and configure the PATH environment variable accordingly for all three:

Option 1:

Clone this repository with:

git clone git://

Then cd into lift_sbt_prototype and type:

At the sbt prompt, type:


Point your browser to:

Voila a running Lift app

Option 2:

1. Download simple-build-tool jar file from its official source:

2. Create a script sbt.bat to launch sbt:

set SCRIPT_DIR=%~dp0
java -Xmx512M -jar “%SCRIPT_DIR%sbt-launch.jar” %*

if proxy is enabled then use:
java -Dhttp.proxyHost=myproxy -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=mypassword -Xmx512M -jar “%SCRIPT_DIR%sbt-launch.jar” %*

To avoid frequent OutOfMemory errors, try modifying your sbt launch bat script to the following:
java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar “%SCRIPT_DIR%sbt-launch.jar” %*

Note: Keep sbt-launch.jar and sbt.bat in a separate directory and not within scala installation directory.

3. First create the basic structure of Lift project using maven in windows:

mvn archetype:generate -U ^
-DarchetypeGroupId=net.liftweb ^
-DarchetypeArtifactId=lift-archetype-basic ^
-DarchetypeVersion=2.0 ^
-DarchetypeRepository= ^
-DremoteRepositories= ^
-DgroupId=com.myProject1 -DartifactId=myProject1

Note: -DarchetypeArtifactId can have one of the three values

– lift-archetype-blank

– lift-archetype-basic

– lift-archetype-jpa-basic

4. Then cd into myProject1 and run:

5. At the sbt prompt, type:

Project does not exist, create new project? (y/N/s) y
Name: myProject1
Organization: com.myProject1
Version [1.0]:
Scala version [2.7.7]:
sbt version [0.7.4]:

Note: Basically, you enter ‘y’ for yes or ‘s’ for starting a project from scratch (in our case we have already generated our project using maven)

6. Setup the project configuration. Your project configurations are defined at myProject1/project/build/myProject1Project.scala.

Create the directory:


7. Then create the /project/build/myProject1Project.scala file with the following:

import sbt._

class myProject1Project(info: ProjectInfo) extends DefaultWebProject(info)
val snapshots = ScalaToolsSnapshots
val lift = “net.liftweb” % “lift-mapper” % “2.0” % “compile”
val jetty6 = “org.mortbay.jetty” % “jetty” % “6.1.22” % “test”
val h2 = “com.h2database” % “h2” % “1.2.134”
val servlet = “javax.servlet” % “servlet-api” % “2.5” % “provided”
val derby = “org.apache.derby” % “derby” % “” % “runtime”
val junit = “junit” % “junit” % “4.7” % “test”

// required because Ivy doesn’t pull repositories from poms
val smackRepo = “m2-repository-smack” at “”
val nexusRepo = “nexus” at “”

For ~jetty, you will still have to hit return at the sbt prompt to restart jetty in order to see changes. To avoid this use:
override def jettyWebappPath  = webappPath

If you’re running with Jrebel (see near the end of the post), avoid unnecessary redeploys with:
override def scanDirectories = Nil

8. Then on the sbt prompt, run:

9. Next on the sbt prompt, run:

10. Then on the sbt prompt, run:


11. Point your browser to:

Note: Your app is running and accessible at this point

12. To use with IntelliJ IDEA,

a) install the scala and sbt plugin.

b) In Setting => Plugins give the path of sbt-launch.jar file.

c) Go to the “Before launch” options of a Run Configuration, uncheck “Make” and choose “Run SBT Action / test-compile”

d) Create a new IntelliJ IDEA project using Import Project from External Model => Maven

e) Add a Scala aspect to the project, employing Use Files. In Project Structure => Facets => Scala; point the plug-in to the myProject1/project/boot subdirectory where sbt downloaded your Scala

For further improvement in development life cycle:
a) Put libraries in myProject1/lib and sources in myProject1/src

b) On sbt prompt,


action will create a WAR file for when you are ready to deploy your webapp on a production server.

c) JRebel (formerly known as JavaRebel) is a plugin for the Java Virtual Machine that enables on-the-fly reloading of changes made to Java class files.

ZeroTurnaround provide a free JRebel license for developers using Scala.

Download and install JRebel from

In order to integrate JRebel into your build, first turn off automatic reloading in jetty in maven pom.xml by setting the scanIntervalSeconds value to 0:


Then add the following to your MAVEN_OPTS environment variable:

-noverify -javaagent:/path/to/jrebel/jrebel.jar

Following pages were accessed to consolidate this post:

Updates for Scala 2.8 will come soon. Feel free to leave your comments 🙂




  1. I wonder… say, I’m using Scala 2.8; so I have -DarchetypeVersion=2.0-scala280-SNAPSHOT in maven. So, when I run mvn clean jettty: run, it works, but with sbt, update, then jetty-run, I’m getting tons of errors, seems like a totally different lift is being used… any hints?

    Oh, and by the way, a great format and content; pity this transition to 2.8 costs nerves to everybody.

  2. Oh, and I have the information for 2.8 – interested?

    • Yes please ! I would like to know because I encounter the same errors…

  3. “Scala Lift simple build tool – sbt Cheat Sheet | disturbance under still
    waters” was indeed a wonderful article. If it included much more pics this could be perhaps
    even better. Thank u ,Cassandra

  4. Great goods from you, man. I have understand your stuff
    previous to and you are just extremely fantastic. I actually like what you have acquired here, really like what you are stating and the way in which you say it.
    You make it entertaining and you still care for to keep it sensible.
    I can’t wait to read much more from you. This is actually a
    terrific website.

  5. Fantastic items from you, man. I have be mindful your stuff prior to and you’re just too wonderful.
    I really like what you’ve got here, really like what you’re stating and
    the way in which in which you assert it. You are making it entertaining and you
    continue to take care of to keep it wise. I cant wait
    to learn far more from you. That is really a terrific site.

Comments RSS TrackBack Identifier URI

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