【问题标题】:maven artifact version does match with definition in jarmaven 工件版本与 jar 中的定义匹配
【发布时间】:2017-02-01 00:12:22
【问题描述】:

我有一个带有依赖项的项目 pom(由mvn dependency:tree 报告),如下所示:

[INFO] +- com.gttown:gttown-dao-enterprise:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- com.gttown:gt-common-mybatis:jar:0.0.1-SNAPSHOT:compile
[INFO] |  |  +- org.mybatis.generator:mybatis-generator-core:jar:1.3.2:compile
[INFO] |  |  +- org.springframework:spring-jdbc:jar:4.2.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-tx:jar:4.2.4.RELEASE:compile
[INFO] |  \- com.gttown:gt-common-util:jar:0.0.1-SNAPSHOT:compile

它依赖于gttown-dao-enterprise 0.0.1-SNAPSHOT,它间接依赖于gt-common-util 0.0.1-SNAPSHOT。但我确实将gttown-dao-enterprise 0.0.1-SNAPSHOTgt-common-util 的版本定义为1.0.0-SNAPSHOT

<artifactId>gttown-dao-enterprise</artifactId>
<dependencies>
        <dependency>
            <groupId>com.gttown</groupId>
            <artifactId>gt-common-util</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
        ...
</dependencies>

理论上在项目pom中出现的最终版本应该是1.0.0-SNAPSHOT,maven怎么分析为0.0.1-SNAPSHOT?

【问题讨论】:

    标签: java maven


    【解决方案1】:

    com.gttown:gt-common-mybatis 依赖于 gttown-dao-enterprise 0.0.1-SNAPSHOT,所以 maven 用这个版本解决它,你可以在你的 pom 中排除它,maven 将使用 1.0.0-SNPASHOT。

    <artifactId>gttown-dao-enterprise</artifactId>
    <dependency>
        <groupId>com.gttown</groupId>
        <artifactId>gt-common-mybatis</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <exclusions>
            <exclusion> 
              <groupId>com.gttown</groupId>
              <artifactId>gt-common-util</artifactId>
            </exclusion>
         </exclusions>
    </dependency>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-11
      • 1970-01-01
      • 2016-02-13
      • 2012-06-22
      • 2020-10-17
      • 2016-01-05
      • 2023-04-03
      • 1970-01-01
      相关资源
      最近更新 更多