As promised, I tried for the multiple executions.

For the moment maven-antrun-plugin do not allows you to skip plugin's
execution
cf. http://jira.codehaus.org/browse/MANTRUN-65, Vote for it ! :-)

But you can do this :

parent-pom :
------------------
   <build>
       <pluginManagement>
           <plugins>
               <plugin>
                   <artifactId>maven-antrun-plugin</artifactId>
                   <executions>
                       <execution>
                           <id>antrun_id1</id>
                           <phase>validate</phase>
                           <configuration>
                               <tasks>
                                   <echo message="project.build.directory =
${project.build.directory}"/>
                               </tasks>
                           </configuration>
                           <goals>
                               <goal>run</goal>
                           </goals>
                       </execution>
                       <execution>
                           <id>antrun_id2</id>
                           <phase>validate</phase>
                           <configuration>
                               <tasks>
                                   <echo message="antrun id 2 execution"/>
                               </tasks>
                           </configuration>
                           <goals>
                               <goal>run</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </pluginManagement>
   </build>

module1-pom:
----------------------
 <build>
   <plugins>
       <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
           <executions>
                       <execution>
                           <id>antrun_id1</id>
                           <phase>validate</phase>
                           <configuration>
                               <tasks>
                                   <echo message="NOTHING TO DO..."/>
                               </tasks>
                           </configuration>
                       </execution>
                   </executions>
       </plugin>
   </plugins>
 </build>

It results:
-------------
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module1:jar:1.0-SNAPSHOT
[INFO]    task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: antrun_id1}]
[INFO] Executing tasks
    [echo] NOTHING TO DO...
[INFO] Executed tasks
[INFO] [antrun:run {execution: antrun_id2}]
[INFO] Executing tasks
    [echo] antrun id 2 execution
[INFO] Executed tasks
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module2:jar:1.0-SNAPSHOT
[INFO]    task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: antrun_id1}]
[INFO] Executing tasks
    [echo] project.build.directory =
P:\03-Maven\dev\tests\multimodules\skip-parent\02-pluginManagement\module2\target
[INFO] Executed tasks
[INFO] [antrun:run {execution: antrun_id2}]
[INFO] Executing tasks
    [echo] antrun id 2 execution
[INFO] Executed tasks

---

So it seems to be good !
Nevertheless, it's better to can skip the antrun execution.

Rémy

Reply via email to