我正在尝试在一些使用 ant 脚本的遗留项目上进行“干净的 Maven”设置。我对 ant 不太了解,所以我的问题可能看起来很幼稚。
我快完成了,但是由于类路径中的冗余,传递 ant 脚本失败了。如果我理解构建,这些行应该添加到“提供”范围内的每个库的类路径中:
<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 目录中的库中。
问题是,我使用的 maven pom 依赖于我无法修改的父 pom,因此,我的类路径中有三个不同版本的 Ant:两个来自 POM(1.5 et 1.7.1) 和 Eclipse (1.8.2) 中的一个。我尝试过(拼命!)添加一些 Maven 排除项,但惨败。
所以我想:也许有一种方法可以从 Ant 类路径中排除 jar。我尝试过:
<exclude name="*ant\1.7.1\ant-1.7.1.jar"/>
<exclude name="*ant\1.5\ant-1.5.jar"/>
在文件集部分,但它不起作用。有没有办法排除那些多余的jar?
最佳答案
试试这个方法:-
<exclude name="**/ant/1.7.1/ant-1.7.1.jar"/>
<exclude name="**/ant/1.5/ant-1.5.jar"/>
关于java - 从 ant 类路径中排除 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10205592/