Hello.
I am using Clojure 1.11.1 (and org.clojure/tools.deps "0.18.1354") but I am experiencing problems with the transitive dependency resolution: some dependencies are not being included in the classpath.
The simplified scenario that is causing the issue is as follows:
"dependency tree""
my-company/my-lib :mvn/version 5
|_ my-company/base-lib :mvn/version 1
|_ general/some-lib :mvn/version 1.0
|_ general/some-other-lib :mvn/version 1.0
my-company/another-lib :mvn/version 3
|_ my-company/base-lib :mvn/version 2
|_ general/some-lib :mvn/version 1.0
|_ general/some-other-lib :mvn/version 1.0
The issue that is happening is
transitive dependency expansion/resolution logic
add: [my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0]]
add: [my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0] -> general/some-other-lib [1.0]]
add: [my-company/my-lib [5] -> my-company/base-lib [2] -> general/some-lib [1.0]] <== when this arrives the "children" [general/some-other-lib] is not added to the queue because the [general/some-lib [1.0]] has already been "seen" and previously added
However, the dependency "[my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0] -> general/some-other-lib [1.0]]" will be "rejected" because of :missing-parent
, as the "[my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0]]" was replaced by the "[my-company/my-lib [5] -> my-company/base-lib [2] -> general/some-lib [1.0]]" (newer version of the my-company/base-lib
). Unfortunately there is no entry in the queue for the general/some-lib [1.0]
, as it was previously skipped from being added, as its direct parent general/some-lib [1.0]
had already been added (although from a different "absolute" path).
And then my project fails because the classes/namespaces from general/some-other-lib [1.0]
could not be found, as this lib was not included in the classpath.
Debugging a bit I was able to identify that the problem seems to be with this part of the code:
https://github.com/clojure/tools.deps/blob/master/src/main/clojure/clojure/tools/deps.clj#L230-L240