Reputation: 1461
In our "big build" (40+ modules), we have several modules that contain only tests.
When I give -DskiptTests to mvn, the tests are not executed.
But they are compiled, which costs up to a minute of build time.
How can I selectively turn off such modules when the option skipTests is set?
Upvotes: 4
Views: 353
Reputation: 81637
Just to clarify the Gareth David point:
mvn ... -DskipTests
, only the execution of tests is skipped. This is the same behavior if you run mvn ... -Dtest=notest
mvn ... -Dmaven.skip.test=true
, then both test execution and compilation are skipped.So the second command is enough, without any modification of your pom.xml
file.
(source)
Upvotes: 1
Reputation: 28059
You'd have to organize your root pom such that the test modules are activated via a profile, and instead of using -Dmaven.test.skip
to turn use -P!testProfile
to deactivate them and hence skipping them.
Another thought is that you could just do:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<skip>${maven.test.skip}</skip>
</configuration>
</plugin>
</plugins>
I haven't actually tried that... it should in theory work. I seem to remember that the <skip>
configuration is on all plugins.
Upvotes: 2