How can I make leiningen 2 respect the local repository path in maven's settings.xml file?

clojure, leiningen

Solution

You can override the local repository location for an individual project in the project.clj file like this

(defproject test-local "1.0.0-SNAPSHOT"
  :description "Use a local repo location."
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [com.cemerick/pomegranate "0.0.13"]]
  :local-repo "my-repo")

It is possible to set a relative path under the project directory as above or an absolute path. It doesn't seem to be possible to use a shortcut for the home directory and set this to something like "~/my-repo".

You can make all projects use the same location by adding the key to your profiles.clj file.

{:user {:plugins [[lein-swank "1.4.4"]]
        :local-repo "/home/jeff/my-repo"}}

Problem

Leiningen 2 doesn't seem to use the localRepository setting in my ~/.m2/settings.xml file, it just dumps everything it downloads into ~/.m2/repository regardless. How can I tell leiningen 2 where to download stuff to?

Original source