How to include non clojars/maven clojure version in your lein project

Do you need to have a specific version of Clojure in your leiningen project that you can’t get from Clojars?

I ran into this problem when I wanted to run a sample project on Clojure’s reducers – which is not in the current Clojars version of 1.4.0.  I needed to use the most recent version, (unreleased), of 1.5.0.  These are the steps to get you running.

  • Clone the clojure git repository 
  • In the project directory – run ant to build the jar
  • Install the jar into your local maven repo

mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dfile=clojure-1.5.0-master-SNAPSHOT.jar -DpomFile=pom.xml

  • Now you can update your lein project.clj with

(defproject reducers "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]])

Run lein deps and you should be all set.

 

This trick also works with running leiningen projects with Datomic.  In this case – download the Datomic library and from the root directory run
 mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dfile=datomic-0.1.3164.jar -DpomFile=pom.xml

******* Update *******
I found out that there is already an alpha version of Clojure on Maven. So you don’t need to do the build. http://mvnrepository.com/artifact/org.clojure/clojure/1.5.0-alpha2

It would simply be
(defproject reducers "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.5.0-alpha2"]])

2 thoughts on “How to include non clojars/maven clojure version in your lein project

  1. Niels

    It’s even easier getting the 1.5 snapshot from the Sonatype Snapshot repository. just include the following in your lein project file:

    :repositories [["sonatype-snapshots" "https://oss.sonatype.org/content/repositories/snapshots/"]]
    :dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>