I have maven project with modules. I want on run mvn install that install phase of all modules is executed and after that ant task from parent project is executed. I have the following parent pom.xml
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>install</phase>
ant task
</execution>
</executions>
</plugin>
</plugins>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
But when i run mvn install ant task is executed in all modules, not in the root project.
Parent pom is used to hold general information about the underlying modules. So this behaves as expected.
Move your ant task to a separate module and inside this module you can call your ant script after the install phase.