Tweets about "scala lift"
STEP 1 Download the ‘Lift Basic’ template
Going through the liftweb app structure
There is sbt-launch-0.12.jar, which means the Lift Basic template comes with a SBT launcher, so there’s no need to install sbt separately.
The src/main structure is
The MVC looking architecture of liftweb is
STEP 2 : Building an app
Add Lift and Jetty to project dependencies:
#The build.sbt file is
The project/plugins.sbt file is
The sbt script is
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29/lift_basic$ sudo vi sbt
java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.jar "$@"
The command ‘sbt update ~jetty-run’ will download all necessary libraries (Scala, Lift, Jetty, etc) like mvn install does in maven, compile the application, and then launch Jetty as an embedded application – there’s no need to install Jetty separately, (~jetty-run isn't working in my case).
STEP 3 : Run app with sbt
sbt tasks can be viewed with $ sbt tasks command.
Open http://localhost:8080 in a web browser to see the application running.
References
Getting Started, https://www.assembla.com/spaces/liftweb/wiki/Getting_Started
STEP 1 Download the ‘Lift Basic’ template
prayag@prayag:/backup/workspace.programming/workspace.scala$ git clone git://github.com/lift/lift_25_sbt.git Cloning into 'lift_25_sbt'... remote: Counting objects: 881, done. remote: Compressing objects: 100% (506/506), done. remote: Total 881 (delta 301), reused 839 (delta 259) Receiving objects: 100% (881/881), 3.03 MiB | 20 KiB/s, done. Resolving deltas: 100% (301/301), done.
Going through the liftweb app structure
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29$ ls -l lift_basic/ total 1100 -rw-rw-r-- 1 prayag prayag 1159 Nov 16 16:33 build.sbt drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 project -rwxrwxr-x 1 prayag prayag 116 Nov 16 16:33 sbt -rw-rw-r-- 1 prayag prayag 137 Nov 16 16:33 sbt.bat -rw-rw-r-- 1 prayag prayag 1103617 Nov 16 16:33 sbt-launch-0.12.jar drwxrwxr-x 4 prayag prayag 4096 Nov 16 16:33 src
There is sbt-launch-0.12.jar, which means the Lift Basic template comes with a SBT launcher, so there’s no need to install sbt separately.
The src/main structure is
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29$ ls -l lift_basic/src/main/ total 12 drwxrwxr-x 3 prayag prayag 4096 Nov 16 16:33 resources drwxrwxr-x 4 prayag prayag 4096 Nov 16 16:33 scala drwxrwxr-x 6 prayag prayag 4096 Nov 16 16:33 webapp
The MVC looking architecture of liftweb is
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29$ ls -l lift_basic/src/main/scala/code/ total 20 drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 comet drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 lib drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 model drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 snippet drwxrwxr-x 2 prayag prayag 4096 Nov 16 16:33 view
STEP 2 : Building an app
Add Lift and Jetty to project dependencies:
#The build.sbt file is
name := "Lift 2.5 starter template" version := "0.0.1" organization := "net.liftweb" scalaVersion := "2.9.1" resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", "releases" at "http://oss.sonatype.org/content/repositories/releases" ) seq(com.github.siasia.WebPlugin.webSettings :_*) scalacOptions ++= Seq("-deprecation", "-unchecked") libraryDependencies ++= { val liftVersion = "2.5-M3" Seq( "net.liftweb" %% "lift-webkit" % liftVersion % "compile", "net.liftweb" %% "lift-mapper" % liftVersion % "compile", "net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-2.0"), "org.mortbay.jetty" % "jetty" % "6.1.22" % "container", "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test", "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"), "ch.qos.logback" % "logback-classic" % "1.0.6", "org.specs2" %% "specs2" % "1.12.1" % "test", "com.h2database" % "h2" % "1.3.167" ) }
The project/plugins.sbt file is
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1") //Uncoment this line to enable the sbt idea plugin addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0") //Uncoment this line to enable the sbt eclipse plugin addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
The sbt script is
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29/lift_basic$ sudo vi sbt
java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.jar "$@"
The command ‘sbt update ~jetty-run’ will download all necessary libraries (Scala, Lift, Jetty, etc) like mvn install does in maven, compile the application, and then launch Jetty as an embedded application – there’s no need to install Jetty separately, (~jetty-run isn't working in my case).
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29/lift_basic$ ./sbt update ~jetty-run
STEP 3 : Run app with sbt
sbt tasks can be viewed with $ sbt tasks command.
prayag@prayag:/backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29/lift_basic$ ./sbt > update > container:start [info] Compiling 4 Scala sources to /backup/workspace.programming/workspace.scala/lift_25_sbt/scala_29/lift_basic/target/scala-2.9.1/classes... [info] 'compiler-interface' not yet compiled for Scala 2.9.1.final. Compiling... [info] Compilation completed in 37.636 s 2012-11-16 23:14:24.820:INFO::Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-6.1.22 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet [info] Started SelectChannelConnector@0.0.0.0:8080 [success] Total time: 56 s, completed 16-Nov-2012 23:14:30
Open http://localhost:8080 in a web browser to see the application running.
References
Getting Started, https://www.assembla.com/spaces/liftweb/wiki/Getting_Started
No comments:
Post a Comment