title: Exclude jar from ant classpath
body: <p>I'm trying to make a "clean maven" setup on some legacy project that uses ant scripts. I don't know much about ant, so my question might seem naive.</p>
  
  <p>I'm almost done, but the delivery ant script is failing, due to a redundancy in the classpath.  If I understand the build, those lines should add to the classpath every lib in the "provided" scope :</p>
  
  <pre><code>&lt;artifact:dependencies pathid="dependency.classpath" scopes="provided"&gt;
      &lt;pom file="./pom.xml"/&gt;
  &lt;/artifact:dependencies&gt;
  </code></pre>
  
  <p>And then this one :</p>
  
  <pre><code>&lt;path id="completecp"&gt;
      &lt;fileset dir="${ant.home}/lib"&gt;
          &lt;include name="*.jar" /&gt;
      &lt;/fileset&gt;
      &lt;path refid="dependency.classpath" /&gt;
  &lt;/path&gt;
  </code></pre>
  
  <p>Add those dependencies to the libs in the ant.home directory. </p>
  
  <p>The trouble is, I'm using a maven pom that is dependent on a parent pom that I can't modify, and as a result, there are THREE different versions of Ant in my classpath : two from the POM (1.5 et 1.7.1) and one from Eclipse (1.8.2). I've tried (desperately !) addind some maven exclusions, but failed miserably. </p>
  
  <p>So I thought : maybe there is a way of excluding jars from the Ant classpath. I've tried putting :</p>
  
  <pre><code>&lt;exclude name="*ant\1.7.1\ant-1.7.1.jar"/&gt;
  &lt;exclude name="*ant\1.5\ant-1.5.jar"/&gt;
  </code></pre>
  
  <p>in the fileset part, but it doesn't work. Is there a way of excluding those redundant jar ?</p>