【发布时间】:2015-04-27 21:14:31
【问题描述】:
我有一个要在 Tomcat 中部署的 webapp,其中有两个模块具有各自的依赖项。我遇到了一个问题,其中模块 A 中的一个库的依赖项的版本比模块 B 中不同库所需的版本旧得多。例如,以下是 pom 文件中的依赖项:
模块 A:
<dependencies>
<dependency>
<groupId>org.example.com</groupId>
<artifactId>libraryA</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
模块 B:
<dependencies>
<dependency>
<groupId>org.another.com</groupId>
<artifactId>libraryB</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
libraryA 依赖于 libraryC 1.0 版,而 libraryB 依赖于 libraryC 2.0 版。 libraryA 将无法与 libraryC 的新版本一起使用,而 libraryB 将无法与 libraryC 的旧版本一起使用。我有哪些选择(如果有的话)让这些模块存在于同一个 Tomcat webapp 中,使用这些依赖项的不同版本?
【问题讨论】: