Are you sure it’s hard to change the configuration of the surefire plugin? Since you can change it once only in your module ...
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12</version> <configuration> <skipTests>${skip.foo.module.tests}</skipTests> </configuration> </plugin> </plugins> </build>
... and pass the true / false value of the skipTests tag to the maven property activated by the special profile:
<properties> <skip.foo.module.tests>false</skip.foo.module.tests> </properties> <profiles> <profile> <id>SKIP_FOO_MODULE_TESTS</id> <properties> <skip.foo.module.tests>true</skip.foo.module.tests> </properties> </profile> </profiles>
So that you can deactivate tests in the Foo module using the command line:
mvn clean test -P SKIP_FOO_MODULE_TESTS
Yanflea
source share