这是我从pom.xml文件
的插件配置 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>run-unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<skipITs>true</skipITs>
<skipUTs>false</skipUTs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>run-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<skipITs>false</skipITs>
<skipUTs>false</skipUTs>
</configuration>
</plugin>
我有2个测试类HelloTest.java
和WorldITest.java
。
当我运行mvn clean test
时,我希望它只执行 HelloTest 。但是当我执行mvn clean integration-test
时,我希望执行 HelloTest 和 WorldITest 。
但问题是它还在mvn clean test
命令中执行了集成测试。
PS:原始代码来自讨论:Prevent unit tests in maven but allow integration tests