blob: 54a64f02ab633154ec2ca5a77130d9d5708a7e50 [file] [log] [blame]
------
Guide to using Ant with Maven
------
Jason van Zyl
------
12 October 2005
------
Guide to using Ant with Maven
The example above illustrates how to bind an ant script to a lifecycle phase. You can add a script to each lifecycle
phase, by duplicating the <execution/> section and specifying a new phase.
+----+
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>my-test-app</artifactId>
<groupId>my-test-group</groupId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<!--
Place any ant task here. You can add anything
you can add between <target> and </target> in a
build.xml.
-->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+----+
So a concrete example would be something like the following:
+----+
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>my-test-app</artifactId>
<groupId>my-test-group</groupId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<exec
dir="${basedir}"
executable="${basedir}/src/main/sh/do-something.sh"
failonerror="true">
<arg line="arg1 arg2 arg3 arg4" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+----+