Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple antrun tasks in maven

Tags:

How would you execute ant tasks at different phases in a maven build cycle?

like image 568
sal Avatar asked Jul 13 '09 18:07

sal


People also ask

What is AntRun in Maven?

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.

Which of the following is a goal of Maven AntRun plugin?

The maven-antrun-plugin has only one goal, run . This allows Maven to run Ant tasks.

Can we use Maven and Ant together?

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.


1 Answers

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> 
like image 96
sal Avatar answered Oct 20 '22 16:10

sal