简体   繁体   English

Clojure / leiningen依赖项如果嵌套则不会下载jar

[英]Clojure/leiningen dependencies not downloading jars if nested

I'm getting the following error: 我收到以下错误:

#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]
  ...

And: 和:

(use 'midje.repl)
CompilerException java.lang.IllegalArgumentException: No matching method: sha1Hex, compiling:(such/random.clj:17:3) 

With these simple dependencies: 这些简单的依赖关系:

[[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]]]

I can fix it by adding to the deps: 我可以通过添加到部门来修复它:

[commons-codec "1.6"]
[commons-codec "1.10"]

From what I can see, 1.6 and 1.10 is needed and the pom is only downloaded if I don't specify it. 据我所知,需要1.6和1.10,并且仅在未指定pom的情况下才下载pom。 If I specify it, it then downloads the jar and all is well. 如果我指定它,那么它将下载jar,一切都很好。

without it directly (only pom): 直接没有它(仅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

with it directly (after adding [commons-codec "1.10"] ): 直接使用它(添加[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

So, the problem looks to be with midje in this case- but I'm guessing it's more a problem with nested dependencies and lein. 因此,在这种情况下,问题似乎出在midje上,但我猜想嵌套的依赖项和lein的问题更多。 Ie if it's a nested dependency, only the pom is downloaded and not the jar. 即,如果它是嵌套的依赖项,则仅下载pom而不下载jar。 When specified directly, the jar is downloaded too. 直接指定时,也将下载jar。

Anyone else seen this problem and know what's up? 其他人看到了这个问题,知道怎么了吗?

You have a number of confusing or conflicting dependencies. 您有许多令人困惑或冲突的依赖项。 Usually smart to have a look at lein deps :tree 通常聪明的去看看lein deps :tree

I rearranged your dependencies and added an exclusions to necessary-evil for commons-codec which seems to fix the problem. 我重新排列了您的依赖关系,并在commons编解码器的必要邪恶中添加了排除项,这似乎可以解决问题。

  :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"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM