如何防止在子pom中覆盖父pom依赖版本 [英] How to prevent from overriding parent pom dependency version in child pom
本文介绍了如何防止在子pom中覆盖父pom依赖版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的父pom具有这样的配置:
I have parent pom with such config:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.9</version>
</dependency>
</dependencies>
</dependencyManagement>
我的孩子pom:
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
</dependencies>
我想在我的类路径中使用4.3.5版本,因为在出现错误的那一刻,不应修改父版本:
I want to use 4.3.5 version in my classpath, because at the moment I am getting error, parent version should not be modified:
java.lang.NoClassDefFoundError: org/apache/http/impl/client/HttpClients
有什么主意如何防止覆盖该4.2.9版本?
Any ideas how to prevent from overriding that 4.2.9 version?
推荐答案
我将父版本更改为所需版本,并删除了对子版本的依赖(简单而最佳的解决方案). 感谢goues @Deltharis的评论!
I changed parent version to desired and removed dependency from child (the simple and the best solution). Thanks goues to @Deltharis for the comments!
这篇关于如何防止在子pom中覆盖父pom依赖版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文