Last Updated on 21 February 2020   |   Print Email
In Java development with Maven build, a build lifecycle will fail if the tests code fails to compile or the tests run produces failures. But sometimes we need to continue the build lifecycle even the tests fail. For example, when packaging the project (mvn package) – the tests code not included in the package – so it can be okay to continue the build without running the tests.To exclude tests from build in Maven, you need to configure Maven Surefire plugin in the pom.xml file as below:
This will exclude all the test classes from the build lifecycle. The following code explains how such tests exclusion configuration relates in Maven’s pom.xml file:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Comments
com.acme.*.*
I'm using the command 'mvn clean test'