Maven 故障保护不 运行 子模块中的测试
Maven failsafe does not run tests in submodule
我有一个项目,其父目录在其 pom.xml
中包含以下内容:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
和
<modules>
<module>submodule</module>
</modules>
子模块子目录再次包含一个 pom.xml
及其父项目的引用。该子目录还包含一些集成测试 运行 如果我将故障安全插件移动到子模块的 pom.xml
然后从父目录调用 mvn verify
就可以了,但这不适用于当前(preferred) setup(没有错误,测试根本就没有执行)。
我尝试在故障安全插件的配置中将子模块工件添加到 dependenciesToScan
,但这并没有解决问题。我是否需要将子模块添加为父模块 pom.xml
中的依赖项?因为在处理 pom.xml
.
时会导致 "dependency is referencing itself" 错误
不胜感激。
编辑:我已经弄明白了,从事该项目的其他人将 build
部分包装在 profile
部分中,起初我没有意识到这一点,因为整个文件相当大而笨重,我忽略了相应的 git 提交。通过撤消该更改并按照 Gerald Broser 发布的 link 中的说明进行操作,我设法解决了我的问题(我想只要执行相应的配置文件也能解决问题,但无论如何该更改都是不必要的)。
试着打电话给
mvn clean verify -P <module>
见Maven Failsafe Plugin / Usage / Usage in multi-module projects:
When you are defining a shared definition of the Failsafe Plugin in a parent pom, it is considered best practice to define an execution id in order to allow child projects to override the configuration.
我有一个项目,其父目录在其 pom.xml
中包含以下内容:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
和
<modules>
<module>submodule</module>
</modules>
子模块子目录再次包含一个 pom.xml
及其父项目的引用。该子目录还包含一些集成测试 运行 如果我将故障安全插件移动到子模块的 pom.xml
然后从父目录调用 mvn verify
就可以了,但这不适用于当前(preferred) setup(没有错误,测试根本就没有执行)。
我尝试在故障安全插件的配置中将子模块工件添加到 dependenciesToScan
,但这并没有解决问题。我是否需要将子模块添加为父模块 pom.xml
中的依赖项?因为在处理 pom.xml
.
不胜感激。
编辑:我已经弄明白了,从事该项目的其他人将 build
部分包装在 profile
部分中,起初我没有意识到这一点,因为整个文件相当大而笨重,我忽略了相应的 git 提交。通过撤消该更改并按照 Gerald Broser 发布的 link 中的说明进行操作,我设法解决了我的问题(我想只要执行相应的配置文件也能解决问题,但无论如何该更改都是不必要的)。
试着打电话给
mvn clean verify -P <module>
见Maven Failsafe Plugin / Usage / Usage in multi-module projects:
When you are defining a shared definition of the Failsafe Plugin in a parent pom, it is considered best practice to define an execution id in order to allow child projects to override the configuration.