【发布时间】:2016-12-13 08:54:31
【问题描述】:
我收到以下错误:
#error {
:cause org.apache.commons.codec.binary.Base32
:via
[{:type clojure.lang.Compiler$CompilerException
:message java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base32, compiling:(crypto/random.clj:1:1)
:at [clojure.lang.Compiler load Compiler.java 7239]}
{:type java.lang.ClassNotFoundException
:message org.apache.commons.codec.binary.Base32
:at [java.net.URLClassLoader$1 run URLClassLoader.java 372]}]
:trace
[[java.net.URLClassLoader$1 run URLClassLoader.java 372]
...
还有:
(use 'midje.repl)
CompilerException java.lang.IllegalArgumentException: No matching method: sha1Hex, compiling:(such/random.clj:17:3)
有了这些简单的依赖:
[[org.clojure/clojure "1.7.0"]
[org.clojure/data.json "0.2.6"]
[ring/ring-core "1.4.0"]
[ring/ring-jetty-adapter "1.4.0"]
[ring/ring-defaults "0.2.0"]
[necessary-evil "2.0.0"]
[compojure "1.5.0"]
[midje "1.8.1" :exclusions [org.clojure/clojure]]]
我可以通过添加到 deps 来修复它:
[commons-codec "1.6"]
[commons-codec "1.10"]
据我所知,需要 1.6 和 1.10,并且只有在我不指定它的情况下才会下载 pom。如果我指定它,它会下载 jar 并且一切正常。
没有它直接(只有pom):
/c/working/tooling-alerts> lein deps
Picked up JAVA_TOOL_OPTIONS: -Duser.home=C:\Users\harrisky
(:repositories detected in user-level profiles! [:user]
See https://github.com/technomancy/leiningen/wiki/Repeatability)
Retrieving commons-codec/commons-codec/1.10/commons-codec-1.10.pom from
直接用它(添加[commons-codec "1.10"]后):
/c/working/tooling-alerts> lein deps
Picked up JAVA_TOOL_OPTIONS: -Duser.home=C:\Users\harrisky
(:repositories detected in user-level profiles! [:user]
See https://github.com/technomancy/leiningen/wiki/Repeatability)
Retrieving commons-codec/commons-codec/1.10/commons-codec-1.10.jar from
因此,在这种情况下,问题似乎出在 midje 上——但我猜它更多的是嵌套依赖项和 lein 的问题。即,如果它是一个嵌套依赖项,则只下载 pom 而不是 jar。直接指定时,jar也会被下载。
其他人看到这个问题并知道发生了什么吗?
【问题讨论】:
-
你看过
lein deps :tree吗? required-evil 使用 commons-codec 1.4 所以我猜这可能是问题所在?
标签: clojure leiningen apache-commons-codec