【问题标题】:Gradle downgrading Hazelcast dependency when there's no other transitive dependency当没有其他传递依赖时,Gradle 降级 Hazelcast 依赖
【发布时间】:2022-03-14 09:54:05
【问题描述】:

我正在使用 Gradle 将项目 A 包含到我的项目 B 中,其中 A 有一个依赖项

implementation group: 'com.hazelcast', name: 'hazelcast', version: '5.0.2'

然后我将 A 包含在 B 的 build.gradle 文件中

implementation(group: '<group_name>', name: 'A', version: '0.2.0-SNAPSHOT') {
    exclude group: 'org.slf4j'
    }

但是,在构建项目时,Hazelcast 以某种方式被降级。依赖树:

    (base) (my name) B % ./gradlew dependencies | grep hazelcast
     +--- com.hazelcast:hazelcast:5.0.2 -> 4.0.3
     +--- com.hazelcast:hazelcast:5.0.2 -> 4.0.3
     +--- com.hazelcast:hazelcast:5.0.2 -> 4.0.3
I commented out all other dependencies in B, to make sure there's no other transitive dependency, but gradle still chooses a lower version of Hazelcast out of no where. Project A build with correct version of Hazelcast 5.0.2. 

我现在通过在 B 中显式添加 Hazelcast 依赖项来强制版本

implementation group: 'com.hazelcast', name: 'hazelcast', version: '5.0.2'

但很想知道正式修复的根本原因。有没有人有类似的问题,或者知道为什么会这样?

【问题讨论】:

  • 你在使用 Spring 吗?
  • @FrantišekHartman 是的,我正在使用 Spring

标签: java gradle dependencies hazelcast


【解决方案1】:

这可能是一个 Spring 插件管理您对 4.0.3 的依赖关系。

尝试以下方法:

ext['hazelcast.version'] = '5.0.2'

https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#managing-dependencies.dependency-management-plugin.customizing

【讨论】:

    猜你喜欢
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 2019-11-04
    • 2016-11-30
    • 1970-01-01
    相关资源
    最近更新 更多