【发布时间】:2019-04-18 07:50:51
【问题描述】:
我有两个 maven 项目,我们称它们为 master 和 aux。 Master 依赖于 aux,也依赖于特定版本的 org.apache.httpcomponents.httpclient。 Aux 依赖于更高版本的 org.apache.httpcomponents.httpclient。
例如
<project...>
<artifactId>master</artifactId>
<groupId>com.my-company</groupId>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>earlier version</version>
</dependency>
<!--<uses later version of http client>-->
<dependency>
<groupId>com.my-company</groupId>
<artifactId>aux</artifactId>
</dependency>
...
</dependencies>
...
</project>
但是,aux 依赖于仅在较新版本的httpclient 中找到的类,并且master 对httpclient 的依赖不向前兼容,因此无论我排除哪个版本,REST 调用都会在预期地点。
有没有办法要求 aux 使用较新的依赖项,而 master 使用较旧的依赖项?
我知道我可以通过修补 aux 和 master 来协调它们以使用相同的依赖项,但这远非理想。
【问题讨论】:
-
你必须制作一个新版本的 aux 使用新版本的 http 否则你会迷路......
标签: java maven dependencies pom.xml diamond-problem