【问题标题】:Ant conditional unless possible?除非可能,否则 Ant 有条件?
【发布时间】:2015-04-14 19:48:32
【问题描述】:

如果满足两个条件之一,我希望执行一个目标。除非针对一个目标进行评估,否则您可以拥有两个吗?本质上,如果其中任何一个为真,我希望目标不要运行:

unless="product.is.x" or "product.is.y"

对不起,如果我以错误的方式处理这个问题,我对 Ant 有点陌生。

【问题讨论】:

标签: ant


【解决方案1】:

阅读targets,他们确切地提到了如何做到这一点:

如果(或除非)已设置属性,目标也可以执行其执行。

在你的情况下,你可以这样做:

<condition property="myTarget.condition">
    <or>
        <equals arg1="${product.is.x}" arg2="true" />
        <equals arg1="${product.is.y}" arg2="true" />
    </or>
</condition>

...

<target name="myTarget" unless="myTarget.condition">
    ...

【讨论】:

    猜你喜欢
    • 2017-10-26
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-21
    • 2020-09-08
    • 2019-05-08
    相关资源
    最近更新 更多