我有一个由很多子项目组成的项目。考虑三个模块 A、B、C。B 依赖于 A,C 依赖于 A 和 B。 A、B、C 都有一个 test-applicationContext.xml 文件。C 使用 A 和 B 作为 test-jar 依赖项。问题是在编译 C 时,duplicate finder 插件为 test-applicationContext.xml 抛出了重复的资源错误。我试图通过使用<excludes>test-jar 目标上的标签从模块 B 中删除测试资源,但 maven 仍然从测试类目录。我验证了为模块 B 创建的 test-jar 没有 xml 文件。有人能告诉我出了什么问题吗?
A 仅打包为测试 jar,而 B 既有主 jar 又有测试 jar 目标。C的pom文件如下:
<dependency>
<groupId>my.project</groupId>
<artifactId>A</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>my.project</groupId>
<artifactId>B</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
A 有 test-applicationContext.xml 如下:
A ---> src/main/resources/test-applicationContext.xml
Run Code Online (Sandbox Code Playgroud)
而 B 的 xml 如下
B ---> src/test/resources/test-applicationContext.xml
Run Code Online (Sandbox Code Playgroud)
在 C 上执行 mvn install 时出现以下错误
[WARNING] …Run Code Online (Sandbox Code Playgroud)