Using <target/>
Attributes
You can specify attributes in the <target/>
configuration to execute or not Ant tasks depending some conditions. For example, to skip Ant call, you could add the following:
<project>
...
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase> <!-- a lifecycle phase --> </phase>
<configuration>
<target unless="maven.test.skip">
<echo message="To skip me, just call mvn -Dmaven.test.skip=true"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>