Recently we got our hands back on a Lift project after some time. A few of our clients had already moved from Lift to Play due to various reasons and one of them seemed to be dismal (read valid) documentation. There seem to be decent information like simply.liftweb.net and exploring.liftweb.net along with the book Lift in Action. But most of these resources seem to be still in the dark ages of getting built by sbt 0.7.5 and what not. I had a hard time getting a colleague of mine getting set up with the basic lift examples given that the other projects that we are currently executing are already on the latest versions. Anyway, here is a quick guide to get you out of the woods, faster.
Let us take an example, say you want to try the code from Snippets and Sitemap. You might want to clone the project from here https://github.com/dpp/simply_lift. You would find snippets and sitemap in the samples folder.
Now one option is to execute it with the sbt-launcher which comes along. Another is to get it converted to the relatively later version of sbt 0.11.3 (ok the latest on the block is 0.13) and use it from there
For that
0) First delete everything in the folder except the src folder
1) Introduce a build.sbt at the following root location which reads like this
name := "snippets" organization := "my.company" version := "0.1-SNAPSHOT" scalaVersion := "2.9.1" resolvers += "Java.net Maven2 Repository" at "http://download.java.net/maven/2/" resolvers += "Scala Tools Releases" at "http://scala-tools.org/repo-releases/" resolvers += "Scala Tools Snapshots" at "http://scala-tools.org/repo-snapshots/" seq(webSettings :_*) libraryDependencies += "org.mortbay.jetty" % "jetty" % "6.1.22" % "container" libraryDependencies ++= { val liftVersion = "2.4" Seq( "net.liftweb" %% "lift-webkit" % liftVersion % "compile", "net.liftweb" %% "lift-mapper" % liftVersion % "compile", "org.mortbay.jetty" % "jetty" % "6.1.26" % "test", "junit" % "junit" % "4.7" % "test", "ch.qos.logback" % "logback-classic" % "0.9.26", "org.scala-tools.testing" %% "specs" % "1.6.9" % "test" ) }
2) To start a container add the following plugin.sbt under the project folder (if you do not have a project folder, just create one)
vikas@vikas-laptop:~/w/knoldus/fleisure/information/simply_lift/samples/snippet_and_sitemap/project$ ls
plugin.sbt project target
That should look like this
resolvers += Classpaths.typesafeResolver resolvers += Resolver.url("Typesafe repository", new java.net.URL("http://typesafe.artifactoryonline.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns) libraryDependencies <+= sbtVersion(v => v match { case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8" case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10" case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11" case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1" })
3) I am assuming you already have an eclipse plugin entry under your ~/.sbt/plugins/build.sbt
If not, add the following line
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
Now execute
$ sbt eclipse
to generate the eclipse files
$sbt ~container:start
to start the webapp with Jetty
On localhost:8080, you should see something similar to
Image may be NSFW.
Clik here to view.
Filed under: Scala Tagged: Eclipse, lift, sbt 0.11.3 Image may be NSFW.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
