4

为什么 sbt (1.3.5) 在严格模式下无法解析相同的依赖关系?

> cat build.sbt
conflictManager := sbt.ConflictManager.strict
libraryDependencies += "io.grpc" % "grpc-all" % "1.26.0"
sbt:test> compile
[error] stack trace is suppressed; run last update for the full output
[error] (update) lmcoursier.internal.shaded.coursier.error.conflict.StrictRule: Rule Strict(Set(ModuleMatcher(*:*)),Set(),false,true,false) not satisfied: lmcoursier.internal.shaded.coursier.params.rule.Strict$EvictedDependencies: Unsatisfied rule Strict(*:*): Found evicted dependencies:
[error] 
[error] io.grpc:grpc-api:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-api:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-auth:1.26.0
[error]    └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-api:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-core:1.26.0
[error]    ├─ io.grpc:grpc-all:1.26.0
[error]    ├─ io.grpc:grpc-netty:1.26.0
[error]    │  └─ io.grpc:grpc-all:1.26.0
[error]    ├─ io.grpc:grpc-okhttp:1.26.0
[error]    │  └─ io.grpc:grpc-all:1.26.0
[error]    └─ io.grpc:grpc-testing:1.26.0
[error]       └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.netty:netty-codec-http2:4.1.42.Final ([4.1.42.Final] wanted)
[error] └─ io.grpc:grpc-netty:1.26.0
[error]    └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-core:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-core:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-netty:1.26.0
[error]    └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-core:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-okhttp:1.26.0
[error]    └─ io.grpc:grpc-all:1.26.0
[error] 
[error] io.grpc:grpc-core:1.26.0 ([1.26.0] wanted)
[error] └─ io.grpc:grpc-testing:1.26.0
[error]    └─ io.grpc:grpc-all:1.26.0
[error] Total time: 0 s, completed 19.12.2019 13:38:43

预期版本和实际版本相同。但是,显式版本覆盖有效,但解决所有传递依赖项很烦人。

是 sbt 还是 coursier bug?

4

1 回答 1

3

是 sbt 还是 coursier bug?

我不是 100% 确定,但我认为这需要在 Coursier 中进行修复。

关于 grpc 的一个有趣的事情乍一看可能并不明显,那就是它使用版本范围声明其依赖关系[1.26.0],而不是仅仅说1.26.0. 这可以通过查看他们的POM 文件来确认。

Coursier(或relaxedForAllModules设置为具体的协调策略的阴影 lm-coursier)似乎正在grpc-api正确解析为1.26.0,但请看一下show updateFull

...
[info]  io.grpc:grpc-api
[info]      - 1.26.0
[info]          evicted: false
[info]          homepage: https://github.com/grpc/grpc-java
[info]          configurations: test, optional, compile, default, runtime
[info]          callers: io.grpc:grpc-protobuf-lite:1.26.0, io.grpc:grpc-protobuf:1.26.0, io.grpc:grpc-stub:1.26.0, io.grpc:grpc-all:1.26.0, io.grpc:grpc-core:1.26.0, io.grpc:grpc-auth:1.26.0
[info]      - [1.26.0]
[info]          evicted: true
[info]          evictedData: version selection
[info]          homepage: https://github.com/grpc/grpc-java
[info]          configurations: test, optional, compile, default, runtime
[info]          callers: io.grpc:grpc-all:1.26.0
[info]      - [1.26.0]
[info]          evicted: true
[info]          evictedData: version selection
[info]          homepage: https://github.com/grpc/grpc-java
[info]          configurations: test, optional, compile, default, runtime
[info]          callers: io.grpc:grpc-auth:1.26.0
[info]      - [1.26.0]
[info]          evicted: true
[info]          evictedData: version selection
[info]          homepage: https://github.com/grpc/grpc-java
[info]          configurations: test, optional, compile, default, runtime
[info]          callers: io.grpc:grpc-core:1.26.0
...

它错误地报告[1.26.0]为被 驱逐的版本1.26.0。它还包括相同的内容与不同的呼叫者三次。

由于 sbt 根据更新报告生成驱逐报告,如果这是固定的,我认为驱逐报告将自行修复。

于 2019-12-26T04:45:24.797 回答