Saturday, November 06, 2010

Apache Maven AntRun Plugin Configuration

Apache Maven logo.Image via Wikipedia
I was looking for an up-to-date example of how to use the Apache Maven AntRun plugin version 1.6. The examples that I found on the plugin's home page have not kept pace with the actual development.

I have included my build.xml example file below, and the pom.xml configuration to run it. Please note the comments under the antrun plugin to understand what is happening.


<?xml version="1.0" encoding="UTF-8"?>
<project name="mavenproject1" default="default" basedir=".">
    <target name="default">
        <echo message="Hello World from build.xml"/>

<project xmlns="" xmlns:xsi=""
                                <!-- Execute an ant task within maven -->
                                <echo message="Hello World from pom.xml"/>
                                <!-- Execute an ant task in an external build.xml file. It assumes the file is called 
                                build.xml and is located in the same directory as the pom.xml file. The target in
                                the external file is called default.
                                <ant target="default"/>
Enhanced by Zemanta


Eric Njogu said...

Thank you. I was having some trouble with ant - maven integration and your post was one of the lights on the way to a solution.

Anonymous said...

Thank you. So much more useful than the maven documentation on this.

Unknown said...

Thanks a lot. What is also not mentioned in Maven doc is that you can also specify an external Ant script like:

Popular Posts