Skip to content

Commit 350e54f

Browse files
committed
Not finding poms, etc. in a repo isn't an error
When an artifact is in one of the Maven repositories configured in boot but not in all of them you would see error messages about not being able to find the artifact in those repositories. This isn't really an error because if it's found in another repo it's fine.
1 parent 6afda49 commit 350e54f

File tree

1 file changed

+49
-28
lines changed

1 file changed

+49
-28
lines changed

boot/aether/src/boot/aether.clj

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
(ns boot.aether
22
(:require
3-
[clojure.java.io :as io]
4-
[clojure.string :as string]
5-
[clojure.pprint :as pprint]
6-
[cemerick.pomegranate.aether :as aether]
7-
[boot.util :as util]
8-
[boot.pod :as pod]
9-
[boot.gpg :as gpg]
10-
[boot.from.io.aviso.ansi :as ansi]
11-
[boot.kahnsort :as ksort])
3+
[clojure.java.io :as io]
4+
[clojure.string :as string]
5+
[clojure.pprint :as pprint]
6+
[cemerick.pomegranate.aether :as aether]
7+
[boot.util :as util]
8+
[boot.pod :as pod]
9+
[boot.gpg :as gpg]
10+
[boot.from.io.aviso.ansi :as ansi]
11+
[boot.kahnsort :as ksort])
1212
(:import
13-
[boot App]
14-
[java.io File]
15-
[java.util.jar JarFile]
16-
[java.util.regex Pattern]
17-
[org.sonatype.aether.resolution DependencyResolutionException]))
13+
[boot App]
14+
[java.io File]
15+
[java.util.jar JarFile]
16+
[java.util.regex Pattern]
17+
[org.sonatype.aether.resolution DependencyResolutionException]
18+
[org.sonatype.aether.transfer MetadataNotFoundException ArtifactNotFoundException]))
1819

1920
(def offline? (atom false))
2021
(def update? (atom :daily))
@@ -33,22 +34,42 @@
3334
(defn update-always! [] (set-update! :always))
3435
(defn set-local-repo! [x] (reset! local-repo x))
3536

37+
(defmulti on-transfer (fn [info] (:type info)))
38+
39+
(defmethod on-transfer :started
40+
[{:keys [method] {:keys [name repository size]} :resource}]
41+
(letfn [(->k [size]
42+
(when-not (neg? size)
43+
(format " (%sk)" (Math/round (double (max 1 (/ size 1024)))))))]
44+
(util/info "%s %s %s %s%s\n"
45+
(case method :get "Retrieving" :put "Sending")
46+
(.getName (io/file name))
47+
(case method :get "from" :put "to")
48+
repository
49+
(str (->k size)))))
50+
51+
(defmethod on-transfer :succeeded
52+
[_])
53+
54+
(defmethod on-transfer :corrupted
55+
[{:keys [error]}]
56+
(when error
57+
(util/fail "%s\n" (.getMessage error))))
58+
59+
(defmethod on-transfer :failed
60+
[{:keys [error]}]
61+
(when (and error
62+
(not (instance? MetadataNotFoundException error))
63+
(not (instance? ArtifactNotFoundException error)))
64+
(util/fail "%s\n" (.getMessage error))))
65+
66+
(defmethod on-transfer :default
67+
[_])
68+
3669
(defn transfer-listener
37-
[{type :type meth :method {name :name repo :repository size :size} :resource err :error :as info}]
70+
[info]
3871
(util/dbug "Aether: %s\n" (with-out-str (pprint/pprint info)))
39-
(letfn [(->k [size] (if (neg? size) "" (str (Math/round (double (max 1 (/ size 1024)))))))]
40-
(case type
41-
:started
42-
(util/info "%s %s from %s (%sk)\n"
43-
(case meth :get "Retrieving" :put "Sending")
44-
(.getName (io/file name))
45-
repo
46-
(->k size))
47-
48-
(:corrupted :failed)
49-
(when err (util/fail "%s\n" (.getMessage err)))
50-
51-
nil)))
72+
(on-transfer info))
5273

5374
(defn ^{:boot/from :technomancy/leiningen} build-url
5475
"Creates java.net.URL from string"

0 commit comments

Comments
 (0)