I can pass two properties A and B to maven via
mvn test -DA=true
or
mvn test -DB=true
If either A or B is defined i want a target to be skipped. I found it was possible when only A was considered like this:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>skiptThisConditionally</id>
<phase>test</phase>
<configuration>
<target name="anytarget" unless="${A}">
<echo message="This should be skipped if A or B holds" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Now B has to be considered too. Can this be done?
matthias
I would do that with an external
build.xml
file allowing you to define multiple target combined withantcall
and so using one additional dummy target, just to check the second condition.pom.xml
and the build.xml
Alternative solution if you only have 2 conditions: using the
<skip>
configuration attribute for one condition (i.e. maven stuff) and theunless
(i.e. ant stuff) for the other condition: