【问题标题】:Clojure/leiningen dependencies not downloading jars if nested如果嵌套,Clojure/leiningen 依赖项不下载 jars
【发布时间】: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


【解决方案1】:

您有许多令人困惑或相互冲突的依赖项。平时很聪明的去看看lein deps :tree

我重新安排了您的依赖项,并为 commons-codec 添加了必要的邪恶排除项,这似乎可以解决问题。

  :dependencies [[org.clojure/clojure "1.7.0"]
                 [midje "1.8.1" :exclusions [org.clojure/clojure]]
                 [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" :exclusions [commons-codec]]
                 [compojure "1.5.0"]

【讨论】:

    猜你喜欢
    • 2012-07-07
    • 2021-01-01
    • 2014-10-02
    • 2021-06-04
    • 1970-01-01
    • 2021-02-20
    • 2013-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多