Thursday, January 19, 2012

Scala and Lift

I'm working on a small discrete event simulation program in scala.  I originally wrote it as a command line program, but I would like to transition it to a web based project.  I've used Lift web framework in the past for this type of project, so I decided to use it again.  It has transitioned from using Maven to sbt to build it.

The four examples provided with the latest version have an included version of sbt, but it is a relatively old version of sbt as is the version of jetty used.  I'd like to use an update version of both.

I immediately ran into problems, but I was able to solve them after a few hours of research and experimentation.

First, I had to add the following lines to the build.sbt file located in the main project directory:

 
seq(webSettings :_*)

libraryDependencies ++= Seq (
"net.liftweb" %% "lift-webkit" % "2.4-M4" % "compile",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.RC4" % "container"
)

This uses a recent version of Lift and jetty.  I tried to move the build.sbt to the project/ directory, but I got the following error:

skr@nb00:Farm$ sbt update ~container:start
/home/skr/Software/Farm/project/build.sbt:7: error: not found: value webSettings
seq(webSettings :_*)
    ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

So I moved build.sbt back up to the main directory.

I had to add the plugins.sbt file in the project directory consisting of:

 // plugins

libraryDependencies <+=
   sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))




Once I made these changes, everything worked as advertised.

 

No comments:

Post a Comment