【问题标题】:Why parent overide version of child dependency为什么父级覆盖子依赖项的版本
【发布时间】:2020-09-18 00:42:06
【问题描述】:

我有 spring boot 应用:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.3.RELEASE</version>
</parent>

支持 hazelcast 3.*

我想使用 hazelcast 4.*,所以我创建了具有一些通用功能的通用 jar 项目并将其添加到我的项目中:

    <dependency>
        <groupId>cz.my</groupId>
        <artifactId>my-hazelcast-common</artifactId>
    </dependency>

此依赖项使用 hazelcast 4.* 当我检查依赖项时,我可以看到使用的是版本 3:

[INFO] +- cz.my:my-hazelcast-common:jar:2.1-SNAPSHOT:compile
[INFO] |  \- com.hazelcast:hazelcast:jar:3.12.8:compile

如何继续使用依赖版本而不是父版本?

【问题讨论】:

    标签: spring-boot maven dependencies pom.xml


    【解决方案1】:

    这些版本在spring-boot-dependencies 中设置,它是您父母的父母。

    您需要覆盖属性

    <hazelcast.version>3.12.8</hazelcast.version>
    <hazelcast-hibernate5.version>1.3.2</hazelcast-hibernate5.version>
    

    可能还有更多,具体取决于您想做什么。

    您不能只忽略这些值并使用依赖项中的值。您需要明确地覆盖它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-22
      • 2014-03-18
      • 2023-03-10
      • 2022-01-23
      相关资源
      最近更新 更多