2

I am new to LIFT, and I am trying to find a reliable instructions how to generate and manage LIFT web project with maven and sbt respectively. Can someone please direct me (or provide here) to the up to date instructions how to setup sbt for the maven generated project? From every post what I've red, it looks like the best setup for the LIFT projects: generate with mvn, manage with sbt. Will you agree? (I cannot generate LIFT/web project with sbt. Right? SBT is only good for managing it. Right? ) Every instructions I tried are out of date though. (I obviously can simply download and un-tar the archetype project, but I want to find a more fundamental approach for managing the environment ) Thanks.

vlr
  • 780
  • 4
  • 16
  • 33

2 Answers2

3

While I'm using lift I don't need a maven at all, just SBT. So, it is very useful to read SBT Getting Started section. Also lift wiki contains some information. But be sure that you read material related to the proper SBT version. And finally, you can pay attention to my lift project template on github.
Good Luck with Lift! It's awesome ;)

By following question in you comment I put here some common config from my projects.
So, that is ./project/build.scala as alternative to ./build.sbt

import sbt._
import Keys._
import com.github.siasia._
import PluginKeys._
import WebPlugin._
import WebappPlugin._

object LiftProjectBuild extends Build {
  override lazy val settings = super.settings ++ buildSettings

  lazy val buildSettings = Seq(
    organization := "com.yourorganization",
    version      := "0.1-SNAPSHOT",
    scalaVersion := "2.9.1")

  def yourWebSettings = webSettings ++ Seq(
    // If you are using jrebel
    scanDirectories in Compile := Nil
    )

  lazy val shade = Project(
    id = "project-name",
    base = file("."),
    settings = defaultSettings ++ yourWebSettings)

  lazy val defaultSettings = Defaults.defaultSettings ++ Seq(
    name := "project-name",
    resolvers ++= Seq(
      "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases", 
      "Java.net Maven2 Repository" at "http://download.java.net/maven/2/"),

    libraryDependencies ++= {
      val liftVersion = "2.4-M5"
      Seq(
        "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
        "org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container",
        "org.squeryl" %% "squeryl" % "0.9.5-SNAPSHOT" % "compile",
        "ch.qos.logback" % "logback-classic" % "1.0.0" % "compile",
        "org.scalatest" %% "scalatest" % "1.6.1" % "test",
        "junit" % "junit" % "4.10" % "test")
    },

    // compile options
    scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
    javacOptions  ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),

    // show full stack traces
    testOptions in Test += Tests.Argument("-oF")
  )
}

./project/build.properties

#Project properties
sbt.version=0.11.1

./project/plugins.sbt

resolvers += Classpaths.typesafeResolver

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "1.5.0")

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

Having these three files are enough to configure sbt.
And of course you can run your application by calling container:start

viktortnk
  • 2,739
  • 1
  • 19
  • 18
  • Thank you for your comment. I tried to follow full configuration example with Build.scala from the following link http://stackoverflow.com/questions/7056635/sbt-web-plugin-not-a-valid-key-jetty-run-similar-jetty-port-jetty-context . I tried simplify that example and configure it without sub-projects, but got the following message: ... java.lang.IllegalArgumentException: Cannot add dependency 'org.mortbay.jetty#jetty;6.1.26' to configuration 'jetty' of module xbaz#foo-http_2.9.0-1;0.0.1 because this configuration doesn't exist! Have you experimented with Full Configuration ? Thanks a lot. – vlr Nov 29 '11 at 01:38
  • lacy, you made my day. Thanks. – vlr Nov 30 '11 at 02:03
  • When you started, by any chance, have you tried to run this project with SBT git clone git://github.com/tjweir/pocketchangeapp.git ? It works for me with mvn, but I could not adjust your config files to run with SBT. I am constant errors when compiling( e.g. errors related to mapper ) – vlr Dec 14 '11 at 01:33
0

Your mileage may vary, but my experience with sbt has been less than stellar (out-of-date docs, breakage on version changes, etc). The recent improvements to the eclipse scala IDE and corresponding maven and jrebel plugins make it a clear winner compared to using sbt.

If you follow the instructions, you'll get the ability to build/package at the command line, but superior support for eclipse features and fast development.

See the sample project setup at:

https://github.com/awkay/lift_squeryl_demo

Tony K.
  • 5,535
  • 23
  • 27