Skip testing during Maven packaging and skip maven Packaging
In a specific project, if you need to skip the test stepSkipTestsThis attribute is set to true.
<pre name="code" class="html"><project> [...]<!--http://blog.csdn.net/redstarofsleep--> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build> [...]</project>
You can also skip the test on the command line:
mvn install -DskipTests
You can also use Maven. test. skipProperty skipping test compilation
mvn install -Dmaven.test.skip=true
If you want to skip the test by default, but you can manually enable it when executing the command, you need to configure it in pom as follows:
<!--http://blog.csdn.net/redstarofsleep--><project> [...] <properties> <skipTests>true</skipTests> </properties> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <skipTests>${skipTests}</skipTests> </configuration> </plugin> </plugins> </build> [...]</project>
Enable it manually when executing the command line:
mvn install -DskipTests=false
For specific descriptions, refer to the official description of skip test: http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html
Reprinted please indicate the source:
Http://blog.csdn.net/redstarofsleep