Welcome! Please see the About page for a little more info on how this works.

0 votes
in Tools by

The Clojure tools.deps resolves remote Maven repositories, and generally obeys the Maven settings.xml. Unfortunately, in the following settings example, it will not pickup the authentication for the mirror. According to Maven convention, the mirror's Id should be used to determine the server settings, in this case "planetmirror.com"

            <name>PlanetMirror Australia</name>

The reason is that the code in tools.alpha.util.maven.clj uses the repository name to find the server-settings:

The following patch fixes the issue:

modified   src/main/clojure/clojure/tools/deps/alpha/util/maven.clj
@@ -77,7 +77,7 @@
   (let [mirrors (.getMirrors settings)
         selector (DefaultMirrorSelector.)]
     (run! (fn [^Mirror mirror] (.add selector
-                                 (.getName mirror)
+                                 (.getId mirror)
                                  (.getUrl mirror)
                                  (.getLayout mirror)
@@ -110,7 +110,8 @@
         maybe-repo (.build builder)
         mirror (select-mirror settings maybe-repo)
         proxy (select-proxy settings (or mirror maybe-repo))
-        ^Server server-setting (->> (.getServers settings) (filter #(= name (.getId ^Server %))) first)    ]
+        server-id (-> (or mirror maybe-repo) (.getId))
+        ^Server server-setting (->> (.getServers settings) (filter #(= server-id (.getId ^Server %))) f    irst)]
       (cond-> builder
         mirror (.setUrl (.getUrl mirror))

1 Answer

+1 vote
selected by
Best answer

Logged as https://clojure.atlassian.net/browse/TDEPS-177, thanks for the report. I will try to get that fixed soon.