当依赖树中包含没有jar文件的依赖项时,clojure.tools.build.api/uber
任务会失败。
以下是一个相对简单的失败测试用例:
(ns build
(:require [clojure.tools.build.api :as b]))
(defn failing-uber [_]
(b/uber {:class-dir "classes"
:uber-file "foo.jar"
:basis (b/create-basis {:project {:deps {'org.apache.jena/apache-jena-libs {:mvn/version "4.2.0" :extension "pom"} }}})})
(comment
(failing-uber {})
)
评估上述函数结果如下:
1. Unhandled clojure.lang.ExceptionInfo
Unexpected lib file:
/Users/rick/.m2/repository/org/apache/jena/apache-jena-libs/4.2.0/apache-jena-libs-4.2.0.pom
{}
uber.clj: 182 clojure.tools.build.tasks.uber/explode
uber.clj: 141 clojure.tools.build.tasks.uber/explode
uber.clj: 257 clojure.tools.build.tasks.uber/uber/fn/fn
PersistentVector.java: 343 clojure.lang.PersistentVector/reduce
core.clj: 6829 clojure.core/reduce
core.clj: 6812 clojure.core/reduce
uber.clj: 256 clojure.tools.build.tasks.uber/uber/fn
protocols.clj: 49 clojure.core.protocols/iter-reduce
protocols.clj: 75 clojure.core.protocols/fn
protocols.clj: 75 clojure.core.protocols/fn
protocols.clj: 13 clojure.core.protocols/fn/G
core.clj: 6830 clojure.core/reduce
core.clj: 6812 clojure.core/reduce
uber.clj: 254 clojure.tools.build.tasks.uber/uber
uber.clj: 241 clojure.tools.build.tasks.uber/uber
Var.java: 384 clojure.lang.Var/invoke
api.clj: 394 clojure.tools.build.api/uber
api.clj: 339 clojure.tools.build.api/uber
REPL: 21 build/eval25043
REPL: 21 build/eval25043
Compiler.java: 7181 clojure.lang.Compiler/eval
Compiler.java: 7136 clojure.lang.Compiler/eval
core.clj: 3202 clojure.core/eval
core.clj: 3198 clojure.core/eval
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1977 clojure.core/with-bindings*
core.clj: 1977 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 662 clojure.core/apply
regrow.clj: 20 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 202 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 201 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 825 java.lang.Thread/run
我认为这是因为上述依赖项没有相应的jar文件,只包含pom.xml文件,该文件将一组依赖项分组在一起。