gpt4 book ai didi

xml - 运行ant build.xml时出错

转载 作者:行者123 更新时间:2023-12-02 10:48:26 26 4
gpt4 key购买 nike

嗨,下面是我的代码,当我从命令提示符下运行代码作为 Ant 运行iam时,获取错误为

ERROR:
F:\xxx\build.xml:29: Problem: failed to create task or type target
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

这是我的代码:


    <target name="checkout" description="checkout the code from Perforce">
<exec executable="cmd">
<arg value="/c"/>
<arg value="p4 -u -p sync"/>
<arg value="-p"/>
</exec>
</target>
<target name="getlatestcode" description="checkout and get latest code from perforce">
<exec executable="cmd">
<arg value="/c"/>
<arg value="p4"/>
<arg value="-p"/>
</exec>
</target>
<target name="cordovabuild" description="Getting the code and build the project">
<exec executable="cmd">
<arg value="/c"/>
<arg value="p4"/>
<arg value="-p"/>
</exec>
</target>

<target name="run">
<target name="checkout"/>
<target name="getlatestcode" depends="checkout"/>
<target name="cordovabuild" depends="getlatestcode"/>
<target name="run" depends="cordovabuild,getlatestcode,checkout"/>
</target>

最佳答案

您的目标内有目标,这是 Ant 不喜欢的目标,如下所示。

<target name="run">
<target name="checkout"/>
<target name="getlatestcode" depends="checkout"/>
<target name="cordovabuild" depends="getlatestcode"/>
<target name="run" depends="cordovabuild,getlatestcode,checkout"/>
</target>

您应该有一个独立的目标,并且可以像上面的运行(在运行中一个)那样依赖于依赖项。删除运行次数最多的目标及其对应的结束标记,因此它应如下所示:
<target name="checkout"/>
<target name="getlatestcode" depends="checkout"/>
<target name="cordovabuild" depends="getlatestcode"/>
<target name="run" depends="cordovabuild,getlatestcode,checkout"/>

而要运行您的运行目标,您只需发出 ant run(构建文件名为可选,假设根据您的错误在build.xml中包含这些文件)

关于xml - 运行ant build.xml时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27012765/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com