Maven is the most popular project building tool for the Java platform, and the test-driven development (TDD) is also the development method chosen by many teams in Java platform project development. But when building a project with maven, if for some reason, we want not to perform unit tests in this build. So what to do?
There are two command-line arguments that help us prevent maven from performing unit tests while building the project:
- skipTests, such as:
mvn -DskipTests build
- maven.test.skip=true， such as:
mvn -Dmaven.test.skip=true build
-DskipTests，The test case is not executed, but the test case class is compiled to generate the corresponding class file under target/test-classes.
-Dmaven.test.skip=true，Test cases are not executed, and test case classes are not compiled.