Clojure: using a local Maven repository in Leiningen based projects
I had what must be a common problem so I am documenting the solution here using this reference. I have an IntelliJ mixed project with both Java and Clojure code. I wanted to reuse this project in a small Clojure/Compojure web application that uses Leiningen. I added a new target jar_to_local_mvn to the Makefile in my IntelliJ project directory that takes a JAR file in the IntelliJ project directory and adds it to my local Maven repository (the Makefile target for the dependency target jar is not shown):
jar_to_local_mvn: jarThen in my Clojure/Compojure web application project directory I added a local dependency to my project.clj file:
mvn install:install-file -Dfile=knowledgebooks-0.2.0.jar -DgroupId=self \
-DartifactId=knowledgebooks -Dversion=0.2.0 \
-Dpackaging=jar -DgeneratePom=true
[self/knowledgebooks "0.2.0"]Now, when I get all project dependencies it also copies my JAR file in addition to dependencies copied from Clojars (JARs retrieved from Clojars are not shown):
$ lein depsThe code in the IntelliJ project is very stable and is unlikely to change frequently so having to manually re-run the Makefile is not a nuisance.
[copy] Copying 1 file to /Users/mark/Coding/Clojure/KBSportal/lib
Comments
Post a Comment