ant build脚本在窗口上使用命令提示符失败

时间:2013-05-07 18:09:40

标签: ant

我下载了最新版本的ant并使用this guide

进行了安装

我使用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吗?

1 个答案:

答案 0 :(得分:0)

要求使用某些版本的Ant,请使用<antversion> task

<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>