你好。
我正在使用 Clojure 1.11.1 (以及 org.clojure/tools.deps "0.18.1354"),但我遇到了传递依赖解析的问题:一些依赖没有被包含在类路径中。
以下是一个简化的问题场景
“依赖树”
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
发生的问题如下
传递依赖展开/解析逻辑
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
但是,由于:missing-parent
,依赖“[my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0] -> general/some-other-lib [1.0]]”将被“拒绝”,因为“[my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0]]”已被替换为“[my-company/my-lib [5] -> my-company/base-lib [2] -> general/some-lib [1.0]]”(“my-company/base-lib”的新版本)。遗憾的是,队列中没有任何条目为“general/some-lib [1.0]”,因为它之前被省略,没有被添加,其直接父级“general/some-lib [1.0]”已经被添加(尽管来自不同的“绝对”路径)。
然后我的项目失败了,因为在类路径中未包含此库,无法找到“general/some-other-lib [1.0]”的类/命名空间。
经过一些调试,我能够确定问题似乎出在这段代码上
https://github.com/clojure/tools.deps/blob/master/src/main/clojure/clojure/tools/deps.clj#L230-L240