Saturday, September 24, 2011

Scalatra MongoDB Executable Jar Template

Just a quick note that I have updated my giter8 template for a simple Scalatra project using MongoDB. It now uses library versions that are available for Scala 2.9.1 and updates some dependency versions. These dependencies/plugins target SBT 0.10.1 and probably won't work well with other versions. I also added the assembly plugin to make it easy to build an executable jar. I didn't bother to branch since the old one was broken due to some dependency issues.

To start a new project, do the following:


  1. Install giter8

  2. g8 JanxSpirit/scalatra-mongodb

  3. cd *project-name*

  4. sbt

  5. jetty-run

  6. browse to http://localhost:8080/test

  7. If you want an executable jar, run 'assembly' at the SBT prompt

  8. If you want to create a standalone shell command wrapping that jar, run something like 'cat src/main/resources/execute_jar.sh target/scalatra-mongodb-project-assembly-1.0.jar > target/scalatra_mongo'



Hopefully this template is helpful. Cheers!