Friday, July 20, 2012

My simple hack for using local JAR files in my Clojure lein projects

Maybe I shouldn't share bad habits with people but occasionally I see articles for setting up local maven repositories, etc. for using local JAR files in Clojure lein based projects. I have a kludge for doing this simply.

Now, I have to admit that I tend to use a lot of Java code and 3rd party JARs in my Clojure projects - nice if libraries are in Clojars, but if not I create a directory local_jars in a project directory, put any local JARs there, and instead of using lein deps and lein clean I use a Makefile like:

deps:
 lein deps
 cp local_jars/*.jar lib/

clean:
 rm -f -r lib/*
Really simple. A side benefit is that I use lein1 in some projects and lein2 in others. Using Makefile targets insulates me from mistakes using the incorrect version of lein.

Anyone have a better way of doing this? Please let me know.