By default, when building project, Maven will run the entire unit tests automatically. If any of unit test is failed, it will force Maven to abort the building process.

$ mvn install
$ mvn package 

In real life, you may “STILL” need to build your project even some of the cases are failed.

Skip Unit Test

To skip the entire unit test, uses argument “-Dmaven.test.skip=true“.

$ mvn install -Dmaven.test.skip=true
$ mvn package -Dmaven.test.skip=true

Or define skipTests in maven-surefire-plugin.



Now, build the project again, the entire unit tests will be ignored.