I have a parent POM with a bunch of child modules. I want to run an antrun:run task after all the children have executed a package task (I'm using Ant to package my app since i gave up figuring out how to get assembly to work correctly).
I need to have the antrun task execute after all the children - but I can't associate it with package phase since parent gets "packaged" before children, and i need ant to run afterwards.
Is there a way to do it in one command?
Easy workaround, of course, is to run 2 maven commands:
mvn package; mvn antrun:run
But i want to do it in one, if possible
mvn package antrun:run
produces wrong behaviour - it runs antrun:run before child projects' package phase.
Ideally, i'd be able to just type
mvn package
And have that run package phase on all children, and then run antrun:run on parent.
I need to have the antrun task execute after all the children - but I can't associate it with package phase since parent gets "packaged" before children, and i need ant to run afterwards.
Create another module that depends on all children (so that it will be the last project during a reactor build) and bind your antrun stuff on package in this module. Then just run mvn package from the root project.
Put
<inherited>false</inherited> 
in your plugin definition:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>    
           <inherited>false</inherited>
              <executions>
                 <execution>
                   <phase>compile</phase>
                   <configuration>
                     <tasks>
                       <ant antfile="buildall.xml">
                       </ant>
                    </tasks>
                 </configuration>
                 <goals>
                    <goal>run</goal>
                </goals>
              </execution>
           </executions>
       </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With