Exclude jar from ant classpath
I am trying to setup "pure maven" in some legacy project that uses ant scripts. I don't know much about ant, so my question might seem naive.
I'm almost ready, but the ant script delivery fails due to redundancy in the classpath. If I understand assembly, these lines should add to the classpath every lib in the "provided" scope:
<artifact:dependencies pathid="dependency.classpath" scopes="provided">
<pom file="./pom.xml"/>
</artifact:dependencies>
And then this one:
<path id="completecp">
<fileset dir="${ant.home}/lib">
<include name="*.jar" />
</fileset>
<path refid="dependency.classpath" />
</path>
Add these dependencies to the libs in the ant.home directory.
The problem is that I am using a maven pom that depends on the parent pom, which I cannot change, and as a result, there are three different ant versions in my classpath: two from the POM (1.5 et 1.7.1) and one from Eclipse (1.8.2). I tried (desperately!) Adding some kind of maven exception, but failed unsuccessfully.
So I thought, maybe there is a way to exclude jars from the ant classpath. I've tried putting:
<exclude name="*ant\1.7.1\ant-1.7.1.jar"/>
<exclude name="*ant\1.5\ant-1.5.jar"/>
in the fileset part, but it doesn't work. Is there a way to eliminate this excess jar?
source to share