3

Ant 1.9 的行为与 Ant 1.8 不同,我需要能够在过渡期间同时使用这两者进行构建。我需要zip64mode="never"在 1.9 中设置属性,但是当与 1.8 一起使用时会报告zip doesn't support the "zip64mode" attribute

有没有办法让蚂蚁忽略它不理解的属性?我认为这就是 XML 应该如何工作的方式。

4

2 回答 2

2

首先,以下问题概述了确定正在运行哪个版本的 ANT 的各种方法:

您可以尝试以下操作以使您的构建支持多个版本的 ANT

<antversion property="ant.1.9.or.higher" atleast="1.9"/>

<target name="task-with-zip64mode" if="ant.1.9.or.higher">
..
</target>

<target name="task-without-zip64mode" unless="ant.1.9.or.higher">
..
</target>
于 2013-08-19T21:34:19.293 回答
0

好吧,我找到了一种解决方法……不过,这很麻烦。

我可以利用jar默认为zip64mode="never".

Zip 任务文档:“绝不意味着永远不会编写 Zip64 额外字段,这是 Ant 1.8.x 及更早版本的行为,也是从 Ant 1.9.1 开始的 jar 、 ear 和 war的默认行为。”

它不必有两个目标并检查运行的 ant 版本,但这并不好。

于 2013-08-22T15:12:53.353 回答