1
votes

I have a Nexus repository set up for my company's internal artifacts. The repo also proxies Maven Central, Clojars, etc. I have instructed Leiningen to use my repo by adding the following to my ~/.lein/profiles.clj:

{:user {:mirrors {#".+" {:name "Nuday"
                         :url "http://nexus.example.com:8081/nexus/content/groups/public"}}}}

However, for some dependencies listed in my project.clj, Leiningen seems to ignore my :mirrors setting. Here's a demonstration for a project with the following dependencies:

(defproject com.example.infrastructure/foo "2.1.0"
  :dependencies [[org.clojure/data.json "0.2.4"]
                 [org.clojure/tools.namespace "0.1.1"]])

And now to remove some cached dependencies and compile:

: jmglov@alhana; rm -rf ~/.m2/repository/org/clojure/data.json/
: jmglov@alhana; rm -rf ~/.m2/repository/org/clojure/tools.namespace/
: jmglov@alhana; lein jar
Retrieving org/clojure/tools.namespace/0.1.1/tools.namespace-0.1.1.pom from Nuday
Retrieving org/clojure/tools.namespace/0.2.4/tools.namespace-0.2.4.pom from Nuday
Retrieving org/clojure/tools.namespace/0.2.1/tools.namespace-0.2.1.pom from Nuday
Retrieving org/clojure/tools.namespace/0.2.4/tools.namespace-0.2.4.jar from Nuday
Retrieving org/clojure/tools.namespace/0.1.1/tools.namespace-0.1.1.jar from central
Retrieving org/clojure/data.json/0.2.4/data.json-0.2.4.pom from central
Retrieving org/clojure/data.json/0.2.4/data.json-0.2.4.jar from central
Created foo-2.1.0.jar

As you can see, org.clojure/tools.namespace is retrieved from my private "Nuday" repo, whereas org.clojure/data.json goes directly to the "central" repo. I have verified with Wireshark that my repo is not being queried for the org.clojure/data.json dependency at all.

Does anyone have a clue what might be going on here?

1

1 Answers

0
votes

Actually, it appears the build only successfully pulls down tools.namespace-0.1.1.pom from Nuday (I have no idea from your project.clj why it's attempting to also download the 0.2.1 and 0.2.4 versions of the artifacts).

I recommend confirming that the user has access to the Nexus server and that the user also has write access (given that downloading a new proxy artifact is considered a "write"). My hunch is that Nexus is either failing to proxy the artifacts or performing so abysmally that leiningen gives up on the mirror and tries the regular repositories.