parent a479be07
......@@ -76,7 +76,8 @@
(:module build
:depends-on (package)
:pathname "t/"
:components ((:test-file "pathname")))))
:components ((:test-file "resolve-multiple-maven-dependencies")
(:test-file "pathname")))))
;;; ASDF definitions and the ANSI-TEST suite
;; if a artifact is root then its optional dependencies are
;; collected. If the same artifact is not root, then the optional
;; dependencies are not collected. We don't need optionals since from
;; our point of view we are the top pom and everything specified are
;; dependencies
(defun resolve-multiple-maven-dependencies (dependencies &optional managed-dependencies exclusions (first-is-root nil))
"Return a list of jar file paths that satisfy dependencies
dependencies: a list of maven artifacts. color or slash separated
components groupid:artifactid:versionid
managed-dependencies: a list of maven artifacts. If an dependency
with same groupid and artifactid are encountered, the version
specified here overrides.
exclusions: a list of partial maven artifacts
groupid:artifactid. Dependencies with same groupid and artifactid are
first-is-root: If the first dependency should include optional
dependencies, set this to t. Usually not.
(let ((collect-request (java:jnew (jss:find-java-class "CollectRequest")))
(exclusions-collection (new 'hashset) )
(compile-scope #"JavaScopes.COMPILE"))
(loop for e in exclusions
for (groupid artifactid) = (split-at-char e #\:)
;; If i have scope be compile-scope it doesn't get excluded!!
for exclusion = (new 'aether.graph.Exclusion groupid artifactid "" "jar")
do (#"add" exclusions-collection exclusion))
(loop for a in dependencies
for artifact = (abcl-asdf::make-artifact (#"replaceAll" a "/" ":"))
for dependency = (new 'aether.graph.Dependency artifact compile-scope)
;; setExclusions returns a new dependency. We have to use that. That passed dependency is not modified!
;; Nice of them to clearly document that :-/
(setq dependency (#"setExclusions" dependency exclusions-collection))
(if first-is-root
(#"setRoot" collect-request dependency)
(#"addDependency" collect-request dependency))
(setq first-is-root nil))
(loop for a in managed-dependencies
for artifact = (abcl-asdf::make-artifact (#"replaceAll" a "/" ":"))
for dependency = (new 'aether.graph.Dependency artifact compile-scope)
do (setq dependency (#"setExclusions" dependency exclusions-collection))
(#"addManagedDependency" collect-request dependency))
(let ((dependencies (#"collectDependencies"
(abcl-asdf::ensure-session) collect-request))
(nodelist-generator (new 'PreorderNodeListGenerator))
(dependency-request (new 'DependencyRequest)))
(#"setRoot" dependency-request (#"getRoot" dependencies))
(#"resolveDependencies" (abcl-asdf::ensure-repository-system) (abcl-asdf::ensure-session) dependency-request)
(#"accept" (#"getRoot" dependencies) nodelist-generator)
(split-at-char (#"getClassPath" nodelist-generator) #\:)
(prove:plan 3)
(let ((deps (resolve-multiple-maven-dependencies '("net.sourceforge.owlapi:org.semanticweb.hermit:"
(prove:ok (= (length deps) 87))
(prove:ok (not (find "owlapi-osgidistribution" deps :test 'search)))
(prove:ok (not (find "protege" deps :test 'search))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment