[英]how to skip integration tests with maven release plugin
我想在使用命令运行maven release plugin时跳过集成测试
mvn -B -DskipITs release:prepare release:perform
它似乎没有这种方式。 相同的选项-DskipITs
适用于mvn install/deploy
。 我不想使用-Dmaven.test.skip=true
因为只需要忽略集成测试,而不是单元测试。 完成此任务的最佳方法是什么?
编辑 : -Darguments=-DskipITs
工程release:prepare
,但令人惊讶它不工作的release:perform
。 尝试-Darguments=-Dmaven.test.skip=true
,也不起作用。
试图在pom中为release插件添加<arguments>skipITs</arguments>
,但它会忽略命令行中提供的所有其他-Darguments
。 我不能在插件配置中配置所有内容,因为有些选项会动态获取环境变量。
根据如何制作maven release plugin跳过测试 ,似乎你需要-DskipITs
和-Darguments=-DskipITs
。 一种是跳过编译IT,另一种是跳过运行IT。
使用Maven 配置文件 。
将以下内容添加到您的pom:
<profiles>
<profile>
<id>ItsReleaseTime</id>
<build>
<plugins>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
并调用命令:
mvn -B -P ItsReleaseTime release:prepare release:perform
您可以在pm.xml
文件中添加一些设置。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.