title: Running Ant task on maven: copy, delete files within the projects
body: <p>I had a <code>deploy.ant</code> file in which the whole build process was done, including copying files, executing the protobuf compiler and all that. Now that I am switching to maven, I have <code>pom.xml</code> files which are supposed to do these tasks. I am done almost all, except the <code>deploy.ant</code> script which I am left with.</p>
  
  <p>This script has cleaning, preparing, building and deploying targets. What I need from here is cleaning, preparing and <strong>only some part</strong> of the building target, because the other parts are done by the other <code>pom.xml</code>s.</p>
  
  <p>So in my <code>deploy.ant</code> I have the following code snippets:</p>
  
  <pre><code>&lt;!-- just copying sh and ant files to release folder. --&gt;
      &lt;target name="clean"&gt;
          &lt;delete dir="${install.dir}" /&gt;
      &lt;/target&gt;
  
      &lt;target name="prepare"&gt;
          &lt;mkdir dir="${install.dir}" /&gt;
          &lt;copy file="${template.dir}/run.all.ant" todir="${install.dir}" /&gt;
          &lt;copy file="${template.dir}/run.all.sh" todir="${install.dir}" /&gt;
          &lt;copy file="${template.dir}/kill.all.sh" todir="${install.dir}" /&gt;
          &lt;copy file="${template.dir}/packLogs.sh" todir="${install.dir}" /&gt;
      &lt;/target&gt;
      .
      .
      .
      .
  &lt;!-- copy template files and configurations --&gt;
          &lt;if&gt;
              &lt;available file="${component.project.dir}/conf/config.properties" /&gt;
              &lt;then&gt;
                  &lt;copy file="${component.project.dir}/conf/config.properties" todir="${component.release.dir}/conf" /&gt;
              &lt;/then&gt;
              &lt;else&gt;
                  &lt;echo message="${component.project.dir} does not provide a bundle config - using default from release bundle" /&gt;
                  &lt;copy file="${template.dir}/config.properties" todir="${component.release.dir}/conf" /&gt;
              &lt;/else&gt;
          &lt;/if&gt;
          &lt;if&gt;
              &lt;available file="${component.project.dir}/plans" type="dir" /&gt;
              &lt;then&gt;
                  &lt;copy todir="${component.release.dir}/plans"&gt;
                      &lt;fileset dir="${component.project.dir}/plans" includes="**" /&gt;
                  &lt;/copy&gt;
              &lt;/then&gt;
          &lt;/if&gt; 
           .
           .
            &lt;copy file="../group1/someProject.mw/conf/log4j.xml" todir="${component.release.dir}/conf" /&gt;
              &lt;copy file="${template.dir}/run.ant" todir="${component.release.dir}" /&gt;
              &lt;copy file="${template.dir}/run.sh" todir="${component.release.dir}" /&gt;
  </code></pre>
  
  <p>and this is the maven part I've come up with:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.8&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;install&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;tasks&gt;
                      &lt;echo&gt;Copying .sh and .ant files to release folder&lt;/echo&gt;
                      &lt;basename file="${component.project.dir}" property="component.name" /&gt;
                      &lt;property name="component.release.dir" value="${install.dir}/${component.name}" /&gt;
                      &lt;delete dir="${install.dir}" /&gt;
                      &lt;mkdir dir="${install.dir}" /&gt;
                      &lt;copy file="${template.dir}/run.all.ant" todir="${install.dir}" /&gt;
                      &lt;copy file="${template.dir}/run.all.sh" todir="${install.dir}" /&gt;
                      &lt;copy file="${template.dir}/kill.all.sh" todir="${install.dir}" /&gt;
                      &lt;copy file="${template.dir}/packLogs.sh" todir="${install.dir}" /&gt;
                      &lt;copy file="../group1/someProject.mw/conf/log4j.xml" todir="${component.release.dir}/conf" /&gt;
                      &lt;copy file="${template.dir}/run.ant" todir="${component.release.dir}" /&gt;
                      &lt;copy file="${template.dir}/run.sh" todir="${component.release.dir}" /&gt;
                      &lt;/tasks&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>But as you can see I am quite confused with all these paths and how to integrate them in maven. I suspect the code I shared is correct, as maven would have no idea about what the <code>"${install.dir}"</code> is. </p>
  
  <p>So my question is, how to integrate such tasks in maven using this plugin? Is it simply copy-pasting the ant snippets into the tags of the plugin? If so, how will it ever understand what is meant by the ant properties; paths?</p>