我正在尝试用Ant做到这一点:

<property name="test" value="123"/>
<target name="helloworld" depends="${test}"/>

但是我收到错误消息“该项目中不存在目标$ {test}。”

所以我想我能做到吗?

最佳答案

您可以使用AntCall Task在另一个Task中调用一个Task。

<project>
    <target name="asdf">
        <property name="prop" value="qwer" />
        <antcall target="${prop}" />
    </target>

    <target name="qwer">
        <echo message="in qwer" />
    </target>
</project>

要使一个依赖于另一个,可以在依赖任务中设置一个参数,然后在调用任务中对其进行检查。

关于ant - 在Ant中,我可以在目标的 "depends"内使用属性吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1428200/

10-14 10:41