Use Leiningen With Local M2 Repository

2020-03-10 05:47发布

问题:

I want to compile a local jar into my clojure project, I can do this easily with the following

https://gist.github.com/stuartsierra/3062743

mkdir repo
mvn install:install-file -DgroupId=local -DartifactId=bar \
    -Dversion=1.0.0 -Dpackaging=jar -Dfile=bar.jar \
    -DlocalRepositoryPath=repo

But I have a continuous integration and build server (jenkins) that looks in ~/.m2. How can I get leiningen to look in .m2???

回答1:

Based on the documentation, it looks like the key you're after is :local-repo in project.clj. Since you want to have different local repository locations on different servers, I would put this in a profile as opposed to directly in the project.clj.

Probably the best approach would be to create a :user profile in ~/.lein/profiles.clj on whichever machine you want to change the location of the local repository:

{:user {:local-repo "repo"}}