Recognize a :classifier keyword for dependencies as the Maven classifier

Fixes #58
This commit is contained in:
Howard M. Lewis Ship 2010-06-21 18:14:51 -07:00 committed by Phil Hagelberg
parent 99de1160f2
commit 32ceeba111

View file

@ -75,9 +75,17 @@
(.setGroupId (or (namespace excl) (name excl))) (.setGroupId (or (namespace excl) (name excl)))
(.setArtifactId (name excl)))) (.setArtifactId (name excl))))
(defn make-dependency [[dep version & exclusions]] (defn make-dependency
(let [es (map make-exclusion (when (= (first exclusions) :exclusions) "Makes a dependency from a seq. The seq (usually a vector) should contain a symbol to define the
(second exclusions)))] group and artifact id, then a version string. The remaining arguments are combined into a map. The value
for the :classifier key (if present) is the classifier on the dependency (as a string). The value for
the :exclusions key, if present, is a seq of symbols, identifying group ids and artifact ids to exclude
from transitive dependencies."
[[dep version & extras]]
(let [extras-map (apply hash-map extras)
exclusions (:exclusions extras-map)
classifier (:classifier extras-map)
es (map make-exclusion exclusions)]
(doto (Dependency.) (doto (Dependency.)
;; Allow org.clojure group to be omitted from clojure/contrib deps. ;; Allow org.clojure group to be omitted from clojure/contrib deps.
(.setGroupId (if (and (nil? (namespace dep)) (.setGroupId (if (and (nil? (namespace dep))
@ -86,6 +94,7 @@
(or (namespace dep) (name dep)))) (or (namespace dep) (name dep))))
(.setArtifactId (name dep)) (.setArtifactId (name dep))
(.setVersion version) (.setVersion version)
(.setClassifier classifier)
(.setExclusions es)))) (.setExclusions es))))
(defn make-repository [[id url]] (defn make-repository [[id url]]