Add :update support at the top-level of the project map.

This commit is contained in:
Phil Hagelberg 2012-05-11 11:29:57 -07:00
parent 65460a35f7
commit 176bcf5e6d
3 changed files with 18 additions and 8 deletions

View file

@ -87,9 +87,6 @@
(re-matches re? url))]
cred)))])))
(defn add-auth [repositories]
(map add-repo-auth repositories))
(defn get-proxy-settings
"Returns a map of the JVM proxy settings"
[]
@ -104,11 +101,14 @@
:username username
:password password})))
(defn- update-policy [update [repo-name opts]]
[repo-name (if update (assoc opts :update update) opts)])
(defn- root-cause [e]
(last (take-while identity (iterate (memfn getCause) e))))
(defn- get-dependencies
[dependencies-key {:keys [repositories local-repo offline?] :as project}
[dependencies-key {:keys [repositories local-repo offline? update] :as project}
& {:keys [add-classpath?]}]
{:pre [(every? vector? (project dependencies-key))]}
(try
@ -117,7 +117,9 @@
aether/resolve-dependencies)
:local-repo local-repo
:offline? offline?
:repositories (add-auth repositories)
:repositories (->> repositories
(map add-repo-auth)
(map (partial update-policy update)))
:coordinates (project dependencies-key)
:transfer-listener :stdout
:proxy (get-proxy-settings))

View file

@ -87,5 +87,6 @@
(is (= [["sonatype" {:url "https://oss.sonatype.org/"}]
["internal" {:password "reindur" :username "milgrim"
:url "https://sekrit.info/repo"}]]
(add-auth [["sonatype" {:url "https://oss.sonatype.org/"}]
["internal" {:url "https://sekrit.info/repo"}]])))))
(map add-repo-auth
[["sonatype" {:url "https://oss.sonatype.org/"}]
["internal" {:url "https://sekrit.info/repo"}]])))))

View file

@ -127,7 +127,10 @@
;; You can also set the policies for how to handle :checksum
;; failures to :fail, :warn, or :ignore. In :releases, :daily,
;; :always, and :never are supported.
:releases {:checksum :fail :update :always}}
:releases {:checksum :fail :update :always}
;; You can set :checksum and :update here for them
;; to apply to both :releases and :snapshots:
:update :always, :checksum :fail}
;; Repositories named "snapshots" and "releases" automatically
;; have their :snapshots and :releases disabled as appropriate.
;; Credentials for repositories should *not* be stored
@ -137,6 +140,10 @@
;; :password "locative.1"}}}}
"snapshots" "http://blueant.com/archiva/snapshots"
"releases" "http://blueant.com/archiva/internal"}
;; You can set :update and :checksum policies here to have them
;; apply for all :repositories. Usually you will not set this
;; directly but apply the "update" profile instead.
:update :always
;; the deploy task will give preference to repositories specified in
;; :deploy-repositories, and repos listed there will not be used for
;; dependency resolution.