0

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. If I specify it, it then downloads the jar and all is well.

without it directly (only 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"]):

/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. Ie if it's a nested dependency, only the pom is downloaded and not the jar. When specified directly, the jar is downloaded too.

Anyone else seen this problem and know what's up?

  • Have you looked at `lein deps :tree`? necessary-evil uses commons-codec 1.4 so I guess that might be the problem? – Asthor Aug 07 '16 at 14:10

1 Answers1

0

You have a number of confusing or conflicting dependencies. Usually smart to have a look at lein deps :tree

I rearranged your dependencies and added an exclusions to necessary-evil for commons-codec which seems to fix the problem.

  :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"]
Asthor
  • 598
  • 4
  • 17