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.
I just use a local repo, sort of like this:
ReplyDeletehttps://github.com/candera/khordr/tree/master/repo
And then list it in my project.clj, like this:
:repositories {"local" "file:repo"}
As long as you get the directories right (which is fairly straightforward) it works well. You can add the .sha files to make warnings go away, but it's not strictly necessary.
I think this has two benefits. The first is keeping the jars in source control. The second is that it gives me an easy way to keep multiple versions around without too much trouble.