0

我下载了最新版本的 ant 并使用本指南安装了它

我使用ant命令开始构建过程,我得到了 All features of the build script require Ant version 1.8.2. Please upgrade to 1.8.2 or remove all instances of 'overwrite=no' (and this fail task) from the build script to continue"

这是我的 build.xml 的片段

<!-- Load in Ant-Contrib to give us access to some very useful tasks! -->
<!-- the .jar file is located in the tools directory -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
        <pathelement location="${basedir}/build/tools/ant-contrib-1.0b3.jar"/>
    </classpath>
</taskdef>

 <!-- Test for Ant Version Delete this task and all instances of `overwrite='no'` if you can't upgrade to 1.8.2-->
    <fail message="All features of the build script require Ant version 1.8.2. Please upgrade to 1.8.2 or remove all instances of 'overwrite=no' (and this fail task) from the build script to continue">
        <condition>
            <not>
                <contains string="${ant.version}" substring="1.8.2"/>
            </not>
        </condition>
    </fail>

即使我有 v1.9.0,我也会收到一条失败消息,指出我需要 1.8.2 或执行我所做但无法解决的 overwrite=yes。我只需要使用 v1.8.2 吗?

4

1 回答 1

0

要要求某些版本的 Ant,请使用以下<antversion>任务

<project name="ant-antversion" default="run">
    <target name="run">
        <fail message="This build script requires at least Ant version 1.8.2.">
            <condition>
                <not>
                    <antversion atleast="1.8.2"/>
                </not>
            </condition>
        </fail>
    </target>
</project>
于 2013-05-07T19:25:35.237 回答