Run ant task in maven build phase before war is packaged?
<p>When deploying a webapp I need to  concat some files, currently this is achieved via an ant task. I'm trying to run this task in the maven build process using something like the following:</p>

<pre><code>&lt;plugin&gt;
    &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.7&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;configuration&gt;
                &lt;target&gt;
                    &lt;move file="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/log4j.dev.properties"
                        tofile="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/log4j.properties" /&gt;

                    &lt;move file="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/hibernate.cfg.dev.xml"
                        tofile="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/hibernate.cfg.xml" /&gt;
                    &lt;delete&gt;
                        &lt;fileset dir="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/"
                            includes="**/hibernate.cfg.*.xml" /&gt;
                        &lt;fileset dir="${project.build.directory}/${project.name}-${project.version}/WEB-INF/classes/"
                            includes="**/log4j.*.properties" /&gt;     
                    &lt;/delete&gt;
                &lt;/target&gt;
            &lt;/configuration&gt;
            &lt;goals&gt;
                &lt;goal&gt;run&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</code></pre>

<p>The above fails because the files have not yet been copied/deleted into target directory. If I set the phase to "package" the ant task runs fine and all the files are copied/deleted, but it's no help as the .war has already been built before the ant target is run.</p>

<p>Basically, I need to run my ant target near the end of the prepare-package phase.</p>

<p>Having looked though the <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference" rel="nofollow">Lifecycle Reference</a> I can't workout how to expose the more granular Goals to the antrun plugin.</p>

<p><strong>Question</strong>: How to achieve this scenario?</p>