Clojure Maven2 POM
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Clojure POM for Maven2

Q: A Maven POM for Clojure ?!?

> Yes. Don't run away with your hair on fire. This is only used for dependency
management (and optionaly AOT compile clojure into java classes).

Q: How do I get started ?

> It's easy. Just follow the steps below and you'll
have access to tens of thousands of Java libraries inside Clojure

* Make sure you have > Java5 on your box

* Install Maven [ ]

* Install Clojure Contrib & POM with git & maven.
  You can find maven-friendly repos on my github account.

NOTE: Clojure 1.0.0 is now on the maven repos officially

git clone git://
cd clojure-pom
mvn install
cd ..

git clone git://
cd clojure-contrib
git checkout -b 1.0-SNAPSHOT origin/1.0-SNAPSHOT
mvn install
cd ..

* Now create a new clojure project.  You can create maven archetypes
  if your maven-fu is brown-belt or above.
  Sometimes good ol' 'here' files are easier. I do it like this.

mkdir my-project
cd my-project
cat >pom.xml <<\THEEND
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""
          <!-- optional: precompile some clojure -->
                <java fork="true"
                  <sysproperty key="clojure.compile.path"
                               value="${}" />
                  <arg value="myorg.myproj.hello" />
          <!-- optional: test-is some clojure
                <java classname="clojure.main"
                  <arg value="-e"/>
                  <arg value="(use 'tests) (run-all-tests)"/>
    <!-- optional: 3rd party dependencies -->

mkdir -p src/myorg/myproj
cat >src/myorg/myproj/hello.clj <<\THEEND
(ns myorg.myproj.hello
  (:import [org.apache.commons.math.random JDKRandomGenerator]))
(defn main []
  (println "Hello from org.apache.commons.math.random: "
    (.nextInt (JDKRandomGenerator.))))

mvn process-resources ; # <- now your are ready for emacs slime
mvn compile           ; # <- see it compile your clojure code
mvn test              ; # <- see it test your clojure code
mvn install           ; # <- install a jar for dependant projects (default)
mvn assembly:assembly ; # <- build one big jar for easy deploys

Q: How can I use this in Emacs & Slime ?

> Most of us use emacs 23 (trunk) and slime (trunk) with
Philip Hagelberg's emacs-starter-kit.  I won't cover all that here.
It's on github.
Ask about setup particulars on IRC.  It's rapidly evolving.