gpt4 book ai didi

xml - 如果和除非在 Ant 中

转载 作者:数据小太阳 更新时间:2023-10-29 01:43:54 25 4
gpt4 key购买 nike

我想澄清 ifunless ANT 脚本中的语句

我有以下代码:

<condition property="hasExtensions">
<contains string="${Product_version}" substring="Extensions">
</condition>

<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
...
</exec>

是上面的意思吗<exec>如果 Product_version 将执行 ssremove.exe不包含字符串 "Extensions"

那么相反的情况如何:如果它包含字符串 "Extensions" ?我的代码会像这样吗:

<condition property="hasExtensions">
<contains string="${Product_version}" substring="Extensions">
</condition>
<!-- here below it does not have the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
...
</exec>

<!-- below is for if it has the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" if="hasExtensions">
...
</exec>

最佳答案

你的逻辑是正确的,但我不确定 <exec>任务接受 ifunless属性。查看docs了解更多信息。

您可能需要包装 <exec>检查条件的目标中的任务。例如:

<condition property="hasExtensions">
<contains string="${Product_version}" substring="Extensions">
</condition>

<target name="ssremove" unless="hasExtensions">
<exec executable="${TrueCM_App}\ssremove.exe">
...
</exec>
</target>

然后如果你运行ant ssremove我想你会得到你想要的。

关于xml - 如果和除非在 Ant 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5643918/

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