Friday, August 14, 2009

Getting Scala and Lift 1.1 working without Maven

I want to tinker with Scala and Lift without Maven. It was a bit of a headache to get started, so I'm going to detail what I did, and maybe the information will help someone else.

First, my employer uses a very different application folder layout than the Maven default - and I find it far more intuitive to use. Here are the folders in my project directory:
docs/ (documentation)
src/ (source code root folder)
src/bootstrap/liftweb/ (Boot.scala Lift starting point)
src/com/mycompany/scala/liftweb/myliftapp/ (root of Scala code for my Lift app)
src/com/mycompany/scala/liftweb/myliftapp/snippets (location of Scala code for my Lift "snippets")
src/test/com/mycompany/scala/liftweb/myliftapp/ (location of test Scala code for my Lift app)
webapps/myliftapp/ (root of the web application)
webapps/myliftapp/templates-hidden/ (hidden templates for Lift)
webapps/myliftapp/WEB-INF/classes (compiled Java and Scala classes folder)
webapps/myliftapp/WEB-INF/lib (library location)

Then, to package my .war file I just zip the contents of the project root /webapps/myliftapp/ directory. To me this folder layout seems more intuitive than the Maven default. As a bonus, on my local workstation I set up Apache Tomcat Java web server to use project root /webapps/myliftapp/ is a Context Base, so I restart Tomcat (or reload that application) to get relatively quick development feedback while building the application.

To make it work, I needed a JDK 1.5+, Scala 2.7.5, and downloading the following .jar files and putting them into the lib directory:
commons-collections-3.2.1.jar (Apache Commons Collections)
commons-fileupload-1.2.1.jar (Apache Commons File Upload)
log4j-1.2.15.jar (Log4j)
scala-library.jar (Included in Scala 2.7.5)
And the following can be found under http://scala-tools.org/repo-releases/net/liftweb/
lift-actor-1.1.jar
lift-util-1.1.jar
lift-webkit-1.1.jar

I got up and running in under two hours.

No comments:

Post a Comment