Last Updated: February 25, 2016
· signalpillar

clojure lein 2: change local-repo path


From this document we can see that

When you install lein, it creates ~/.lein and ~/.m2/repository directories for > its own use. The ~/.m2/repository dir is used for caching jars that lein > fetches for your projects, and the lein docs refer to it as “the local repository”.

My maven installation uses repository by path different from ~/.m2, mentioned above as local-repo path. So when I build my dependencies they appear in other place not local repo.

How to change local repository path ?

To change default location of the local repository we need to make add such property in the profile as mentioned here

{:user  {;Location of local repository 
         :local-repo "Drive/Path"
         ;Location of locally installed jars
         ;(that can't be downloaded from public repo's)
              {:url "file://Drive/Path"
               :releases {:checksum :ignore}}}}}            

UPD1 Interesting that this approach works only for lein deps, compile and nrepl but it doesn't work for lein jar/uberjar and install. Looking for solution

UPD2 I have found the same issue posted on github. Very quickly I have got answre (IRC #leiningen) how to upgrade my 2.0.0-preview10 to 2.1.2 where it is fixed. Thanks to hyPiRion.

Two commands

lein upgrade 2.0.0
lein upgrade 2.1.2

And finally it works