How to configure leiningen's maven usage?

2019-06-21 16:27发布

问题:

My problem is that leiningen is not working on my computer. I get errors like these:

Could not transfer artifact lein-ring:lein-ring:pom:0.4.5 from/to central (http://repo1.maven.org/maven2): Connection to http://repo1.maven.org r
Could not transfer artifact lein-ring:lein-ring:pom:0.4.5 from/to clojars (https://clojars.org/repo/): Connection to https://clojars.org refused

I think the problem is that I have a mirror configured in my settings.xml of my maven installation. How can I tell leiningen to use an embedded maven or some other maven installation which does not have custom configuration?

I'm using maven for other java projects and it conflicts somehow with leiningen.

回答1:

You can add mirror definitions to project.clj or, probably better in this case, to ~/.lein/profiles.clj

Details in leiningen sample project.clj

but here's the key bit:

:mirrors {"central" {:name "Ibiblio"
                     :url "http://mirrors.ibiblio.org/pub/mirrors/maven2"}
          #"clojars" {:name "Internal nexus"
                     :url "http://mvn.local/nexus/releases"
                     :repo-manager true}}