参考:https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html
方式一:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
方式二:
mvn package -DskipTests # 不执行测试用例,但编译测试用例类
方式三:
mvn package -Dmaven.test.skip=true # 不执行测试用例,也不编译测试用例类
方式四:
<project>
[...]
<properties>
<skipTests>true</skipTests>
</properties>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
mvn install -DskipTests=false