With Maven, there is more than one way to skip running unit and/or integration tests.
For example:
mvn clean package -DskipTests
(Tests are compiled, but not run)mvn clean install -Dmaven.test.skip
(Tests are neither compiled nor run)If I'm trying to activate a profile based on the fact that tests are being skipped, how could I reliably do that?
I can activate a profile based on absence of one property, but not two:
<profile>
<id>do-something-because-tests-are-skipped</id>
<activation>
<property>
<name>!skipTests</name>
</property>
<property>
<name>!maven.test.skip</name> <!-- Two properties doesn't work -->
</property>
</activation>
<build>
.....
</build>
</profile>
Is there some other way to achieve the desired behaviour?
This has now been implemented in Maven 4.0.0-rc-1
<profile>
<id>do-something-because-tests-are-skipped</id>
<activation>
<condition>
<![CDATA[
not(${skipTests}) && not(${skipITs}) && not(${maven.test.skip})
]]>
</condition>
</activation>
<build>
.....
</build>
</profile>