This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven with Ant task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven with Ant task" Watch "Maven with Ant task" New topic

Maven with Ant task

Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Good day,

I would like to perform some ant task after the war file being generated.

with following script, if i change the phase to different value like "Install" , it will not prompt error, but i want the ant script run once the war file being generated

When i try to save it with value "compile", it prompt me error "Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execution: default, phase: compile)" in eclipse Juno.

appreciated if anyone can shed some light for this and thanks for your time.
Peter Johnson

Joined: May 14, 2008
Posts: 5812

Use the package phase - that is that phase that builds the war file. The antrun:run goal will be run after the war is created.

When you specify in your POM that a goal is to be run in the same phase as a predefined goal, then you goal runs after the predefined goal. If your POM defined multiple goals to be run during a given phase, they will be run in the order in which they appear in the POM, with goal in the parent POM having precedence over your.

Also, there are several phases between "package" and "install", you could always use one of those. (You do have a list of the phases hanging up in your office right next to the monitor, right? Or at least a bookmark to pull up the phases quickly.)

JBoss In Action
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Thanks ! package is working fine for this case, appreciated your time and sharing Peter!
Consider Paul's rocket mass heater.
subject: Maven with Ant task
Similar Threads
Strange problem - works on maven glassfish but not on Tomcat
Tomcat and Axis2
Build problem with maven and eclipse web project
Filtering problem using maven-read-properties plugin in pom.xml file
Could not resolve dependencies for maven project