使用 Nant 检查目标是否动态存在?
根据 Nant 文档,您可以检查是否使用 target::exists 函数存在目标。
Execute target "clean", if it exists.
<if test="${target::exists('clean')}">
<call target="clean" />
</if>
我尝试过将目标名称作为属性传递,但似乎不起作用。
Nant 不会抛出错误,但它也不会在应该返回 true 时返回 true。
本质上我想做的是:
<property name="cleanTarget" value="${someothervariables}"/>
<if test="${target::exists('${cleanTarget}')}">
<call target="${cleanTarget}" />
</if>
这可能吗?
According to the Nant documentation, you can check if a target exists using the target::exists function.
Execute target "clean", if it exists.
<if test="${target::exists('clean')}">
<call target="clean" />
</if>
I've tried passing in the name of the target as a property and it doesn't seem to work.
Nant doesn't throw an error, but neither does it return true, when it should.
Essentially what I'm trying to do is this:
<property name="cleanTarget" value="${someothervariables}"/>
<if test="${target::exists('${cleanTarget}')}">
<call target="${cleanTarget}" />
</if>
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了,我的语法错误。
正确的方法是:
I worked it out, my syntax was wrong.
The correct way would be:
您可以将其简化为:
You could simplify it to: