排除来自蚂蚁classpath中的jar [英] Exclude jar from ant classpath
问题描述
我努力让自己在使用ant脚本一些遗留项目干净行家设置。我不知道很多关于蚂蚁,所以我的问题似乎太天真了。
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.
我差不多完成了,但发货ant脚本失败,因为在类路径冗余。如果我理解构建,这些行应该添加到类路径的每个LIB在规定适用范围:
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 :
<artifact:dependencies pathid="dependency.classpath" scopes="provided">
<pom file="./pom.xml"/>
</artifact:dependencies>
然后这一个:
<path id="completecp">
<fileset dir="${ant.home}/lib">
<include name="*.jar" />
</fileset>
<path refid="dependency.classpath" />
</path>
这些依赖添加到库中的ant.home目录。
Add those dependencies to the libs in the ant.home directory.
麻烦的是,我使用的是Maven的POM是依赖于我不能修改父POM,并作为一个结果,在我的类路径中三个不同版本的Ant:两个来自POM(1.5 1.7.1等)和一个从Eclipse的(1.8.2)。我试过(拼命!)addind一些行家排除,但悲惨地失败了。
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.
所以我想:也许还有在Ant classpath中不包括罐的一种方式。我试图把:
So I thought : maybe there is a way of excluding 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 of excluding those redundant jar ?
推荐答案
试试这个方法: -
Try this way:-
<exclude name="**/ant/1.7.1/ant-1.7.1.jar"/>
<exclude name="**/ant/1.5/ant-1.5.jar"/>
这篇关于排除来自蚂蚁classpath中的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!