首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与父Pom的Maven依赖关系不能正常工作

与父Pom的Maven依赖关系不能正常工作
EN

Stack Overflow用户
提问于 2018-12-18 01:07:37
回答 1查看 1.3K关注 0票数 0

我有下面的maven结构。

亲本Pom

代码语言:javascript
复制
<dependencyManagement>
  <dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.27</version>
  </dependency>
</dependencyManagement>

Service Pom

代码语言:javascript
复制
<parent>
    <groupId>com.aliseeks.dependencies</groupId>
    <artifactId>AliseeksLive</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
    </dependency>
</dependencies>

依赖冲突:

代码语言:javascript
复制
[INFO] +- org.glassfish.jersey.core:jersey-client:jar:2.27:compile
[INFO] |  +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
[INFO] |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile

为什么Maven要引入JerseyCommon 2.25JerseyClient 2.27显然依赖于JerseyCommon 2.25?这是因为JerseyClient 2.27 POM将${project.version}作为变量,并且它在某种程度上被相关性管理搞砸了吗?

依赖树转储

EN

回答 1

Stack Overflow用户

发布于 2018-12-18 14:43:53

泽西-客户端2.27版本取决于泽西-公共2.27版本,如下链接:

https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client/2.27

但它无疑是在提取2.25版本的jersey--解决了传递依赖后的常见问题,maven发现2.25版本是最近的子版本。这就是它决定推出2.25版本的原因。

为了便于参考,这种类型的依赖冲突问题可以很容易地在maven-enforcer-plugin的帮助下进行研究。下面的链接用示例进一步解释了这个插件的用法:

https://dzone.com/articles/solving-dependency-conflicts-in-maven

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53825050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档