Ever realized you needed to modify some dependency (e.g. I needed to add weak cache support to core.cache
), go a head with forking on github, lein install
your new version, modify your project.clj
to pick it up, and then... somehow... you still seem to get the old version?
That's usually because some other dependency is explicitly requesting a version of that library. If you do lein classpath
, you'll see your library show up, in two different versions, with the one you don't want first.
In my case, the relevant bit of classpath shows
/Users/pnf/.m2/repository/org/clojure/core.cache/0.6.3/core.cache-0.6.3.jar: ... :/Users/pnf/.m2/repository/core/cache/core.cache/0.6.5-pnf-SNAPSHOT/core.cache-0.6.5-pnf-SNAPSHOT.jar
So when I try to use core.cache/weak-cache-factory
, I'm told it doesn't exist. How could this happen?
To further debug the problem
lein pom
mvn dependency:tree
UPDATE: Per a comment below, you can get the hierarchy directly
lein deps :tree
with 50% less typing. Those of us who got A's in 8th-grade typing class may have mixed feeligns about this.
After downloading lots of pom.xml
s, this will print out a nice tree structure, the relevant bit for me was
[INFO] +- org.clojure:core.async:jar:0.1.303.0-886421-alpha:compile
[INFO] | \- org.clojure:tools.analyzer.jvm:jar:0.1.0-beta12:compile
[INFO] | +- org.clojure:tools.analyzer:jar:0.1.0-beta12:compile
[INFO] | +- org.clojure:core.memoize:jar:0.5.6:compile
[INFO] | | \- org.clojure:core.cache:jar:0.6.3:compile
[INFO] | | \- org.clojure:data.priority-map:jar:0.0.2:compile
which meant that my [core.cache "0.6.5-pnf-SNAPSHOT"]
was made irrelevant. To fix the issue, I added an :exclusions
block to my core.async
dependency```:
[org.clojure/core.async "0.1.303.0-886421-alpha"
:exclusions [[org.clojure/core.cache]]]
Now, my core.cache
is the only one in the class-path, and all is well.
Wish my JIRA enchancement good luck!
Comments
comments powered by Disqus