2

I've a parent pom containing a maven ant task that needs to be executed by all the children :

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>set-scripts-rights</id>
      <phase>initialize</phase>
      <configuration>
        <tasks>
         <!-- The tasks that needs to be exacuted-->
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>

In one of the children, i don't want the script to be executed then i've added this to the build / plugins section :

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

But despite of this section, the task is always executed. Any idea how i could effectively trash this task in this child ?

antoine
  • 93
  • 7
  • this issue was caused by the version of maven-antrun-plugin. The version i used did not support the usage of skip. Once updating to the latest version it was ok. – antoine Aug 10 '17 at 16:22

1 Answers1

1

This is how I've implemented it in my own working parent pom:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>set-scripts-rights</id>
            <phase>initialize</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <skip>${skip.property.name}</skip>
                <tasks> <!-- NOTE: tasks is deprecated, consider using target instead -->
                    <!-- The tasks that needs to be executed-->
                </tasks> <!-- NOTE: tasks is deprecated, consider using target instead -->
            </configuration>
        </execution>
    </executions>
</plugin>

When triggering the child, set the property ${skip.property.name} and the parent pom should pick it up.

calvin.lau
  • 76
  • 4