Clojure transitive dependency version conflict
Asked Answered
S

1

6

I have a Clojure Leiningen project that has two dependencies A and B and a transitive dependency X which A and B depend on.

A → X [version 1.0]
B → X [version 2.0]

Both A and B are external dependencies. The problem is I can't use version 2 of X for A or version 1 of X for B as it throws java.lang.NoSuchMethodError

Is there a plugin in Clojure that can help shade the transitive dependencies for both A and B or provide an idiomatic way of dealing with this?

Stutsman answered 18/6, 2021 at 11:25 Comment(2)
It might be worth fixing the problem in dependency A and submitting a PR. Or, at least, file an issue requesting a lib upgrade.Dareece
Yes. I have requested for the same to the developers of dependency A. Seems like the ideal/long term resolution.Stutsman
I
3

https://github.com/benedekfazekas/mranderson might be what you're looking for if it's Clojure source.

Idolum answered 18/6, 2021 at 15:54 Comment(1)
This is a nice library. It created a folder in target/srcdeps shadowing the dependency that is tagged including all its dependencies (transitive ones). However, I saw issues with java classes imports resolution and had to manually correct them one by one and copy the shadowed dependency back to the source tree modifying the namespaces to get it working. As this approach is going to mess my code base, I ended up asking the the developers of A to upgrade X.Stutsman

© 2022 - 2024 — McMap. All rights reserved.