Setting up clojure and compojure with maven

I wanted to experiment with building a webapp using Clojure, so I tried setting up the Compojure web framework. I am new to clojure, so I am not sure if this is the preferred way of doing things, but here goes anyway.

There seem to be several ways to set up clojure in emacs. I ended up following Bill Clementson's instructions. A couple of years ago I had some experience using maven, so decided to use this to manage my classpath. Installing maven on my mac was simple with macports (sudo port install maven).

Setting up a POM for maven took longer than expected. Stuart Sierra's post pointed me to the formos maven repository containing the clojure snapshots. With some help from google, I also found the maven-clojure-plugin, which is a maven plugin for compiling clojure, and the clojureshell-maven-plugin which will start a swank session (or bare REPL) using the pom information.

With the basic clojure and maven setup in place, it was time to move on to compojure. I added the Compojure git repository into Bill Clementson's clj-build script, ran it to clone the repository, and then built it using ant (ant deps; ant). Jim Downing instructions for installing compojure into your local maven repository (mvn install:install-file -DgroupId=org.clojure -DartifactId=compojure -Dversion=1.0-SNAPSHOT -Dfile=compojure.jar -Dpackaging=jar) work smoothly.

Discuss this post here.

Published: 2009-09-06

Archive