Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Translate repos into mirrors for resolve-dependencies

Turns out aether only does mirroring internally for repos in
transative dependencies.  It is up to us to map the user
supplied repos to mirrors.
  • Loading branch information...
commit 97463cc6c3290224b95743f5d91e6e27b77493e3 1 parent 5dd3df6
@xeqi xeqi authored
View
17 src/main/clojure/cemerick/pomegranate/aether.clj
@@ -392,8 +392,7 @@ kwarg to the repository kwarg.
:jar-file - a file pointing to the jar
:pom-file - a file pointing to the pom
:local-repo - path to the local repository (defaults to ~/.m2/repository)
- :transfer-listener - same as provided to resolve-dependencies
- :mirrors - same as provided to resolve-dependencies"
+ :transfer-listener - same as provided to resolve-dependencies"
[& {:keys [coordinates jar-file pom-file] :as opts}]
(apply install-artifacts
(apply concat (assoc opts :artifacts
@@ -485,13 +484,19 @@ kwarg to the repository kwarg.
[& {:keys [repositories coordinates retrieve local-repo transfer-listener
offline? proxy mirrors]
:or {retrieve true}}]
- (let [repositories (or repositories maven-central)
+ (let [repositories (or repositories maven-central)
system (repository-system)
session (repository-session system local-repo offline? transfer-listener mirrors)
deps (vec (map dependency coordinates))
- collect-request (CollectRequest. deps
- nil
- (vec (map #(make-repository % proxy) repositories)))
+ collect-request
+ (CollectRequest. deps
+ nil
+ (vec (map #(let [repo (make-repository % proxy)]
+ (-> session
+ (.getMirrorSelector)
+ (.getMirror repo)
+ (or repo)))
+ repositories)))
_ (.setRequestContext collect-request "runtime")
result (if retrieve
(.resolveDependencies system session (DependencyRequest. collect-request nil))
View
4 src/test/clojure/cemerick/pomegranate/aether_test.clj
@@ -70,9 +70,9 @@
(.getAbsolutePath (first (aether/dependency-files deps)))))))
(deftest resolve-deps-with-mirror
- (let [deps (aether/resolve-dependencies :repositories test-remote-repo
+ (let [deps (aether/resolve-dependencies :repositories {"clojars" "http://clojars.org/repo"}
:coordinates '[[javax.servlet/servlet-api "2.5"]]
- :mirrors {"uk" {:url "http://uk.maven.org/maven2" :mirror-of "central"}}
+ :mirrors {"uk" {:url "http://uk.maven.org/maven2" :mirror-of "*"}}
:local-repo tmp-local-repo-dir)]
(is (= 1 (count deps)))
(is (= (.getAbsolutePath (io/file tmp-dir "local-repo" "javax" "servlet" "servlet-api" "2.5" "servlet-api-2.5.jar"))
Please sign in to comment.
Something went wrong with that request. Please try again.