你好。
我正在使用 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
然而,依赖项 "[my-company/my-lib [5] -> my-company/base-lib [1] -> general/some-lib [1.0] -> general/some-other-lib [1.0]]" 将被 "拒绝",因为它有 :missing-parent
,因为 "[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