title: maven antrun: how to iterate over files?
body: <p>I have set up an example at <a href="https://github.com/jjYBdx4IL/example-maven-project-setups/blob/master/antrun-foreach/pom.xml" rel="nofollow">https://github.com/jjYBdx4IL/example-maven-project-setups/blob/master/antrun-foreach/pom.xml</a> :</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;process-test-resources&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;tasks&gt;
                              &lt;taskdef resource="net/sf/antcontrib/antcontrib.properties" /&gt;
                              &lt;foreach target="unzipLibs" param="fileName"&gt;
                                  &lt;path&gt;
                                      &lt;fileset dir="${basedir}" casesensitive="yes"&gt;
                                          &lt;include name="*.xml"/&gt;
                                      &lt;/fileset&gt;
                                  &lt;/path&gt;
                              &lt;/foreach&gt;
                          &lt;/tasks&gt;
                      &lt;/configuration&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;run&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;ant-contrib&lt;/groupId&gt;
                      &lt;artifactId&gt;ant-contrib&lt;/artifactId&gt;
                      &lt;version&gt;1.0b3&lt;/version&gt;
                      &lt;!--                        &lt;exclusions&gt;
                          &lt;exclusion&gt;
                              &lt;artifactId&gt;ant&lt;/artifactId&gt;
                              &lt;groupId&gt;ant&lt;/groupId&gt;
                          &lt;/exclusion&gt;
                      &lt;/exclusions&gt;--&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
              &lt;configuration&gt;
                  &lt;target name="unzipLibs"&gt;
                      &lt;echo message="${fileName}" /&gt;
                  &lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;            
  </code></pre>
  
  <p>However, no matter what I try, it does not work:</p>
  
  <pre><code>Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project antrun-foreach: Error executing ant tasks: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils; -&gt; [Help 1]
  </code></pre>
  
  <p>or, using the ant exclusion:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project antrun-foreach: An Ant BuildException has occured: The following error occurred while executing this line:
  [ERROR] /home/travis/build/jjYBdx4IL/example-maven-project-setups/antrun-foreach/pom.xml:5: Unexpected element "{http://maven.apache.org/POM/4.0.0}project" {antlib:org.apache.tools.ant}project
  [ERROR] around Ant part ...&lt;foreach param="fileName" target="unzipLibs"&gt;... @ 5:48 in /home/travis/build/jjYBdx4IL/example-maven-project-setups/antrun-foreach/target/antrun/build-main.xml
  </code></pre>
  
  <p><a href="https://api.travis-ci.org/jobs/39716289/log.txt?deansi=true" rel="nofollow">Complete build log</a>.</p>
  
  <p>Moving the ant tasks into an external file did not help.</p>
  
  <p>Update: the issue seems to be that maven-antrun-plugin does not support defining multiple antrun targets...... <a href="https://jira.codehaus.org/browse/MANTRUN-86" rel="nofollow">https://jira.codehaus.org/browse/MANTRUN-86</a></p>