How would you execute ant tasks at different phases in a maven build cycle?
This plugin provides the ability to run Ant tasks from within Maven. You can even embed your Ant scripts in the POM! It is not the intention of this plugin to provide a means of polluting the POM, so it's encouraged to move all your Ant tasks to a build.
The maven-antrun-plugin has only one goal, run . This allows Maven to run Ant tasks.
You can use the maven-antrun-plugin to invoke the ant build. Then use the build-helper-maven-plugin to attach the jar produced by ant to the project. The attached artifact will be installed/deployed alongside the pom. If you specify your project with packaging pom , Maven will not conflict with the ant build.
I used this in the build/plugins section
<plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>clean</id> <phase>clean</phase> <configuration> <tasks> <echo message = ">>>>>>>>>>>>>>>>>>>>>>>>>>clean"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> <execution> <id>compile</id> <phase>compile</phase> <configuration> <tasks> <echo message = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>compile"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> <execution> <id>package</id> <phase>package</phase> <configuration> <tasks> <echo message = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>package"/> </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