当我使用该任务时,仅当资源(例如文件)可用时,该属性才会设置为 TRUE。如果不是,则该属性未定义。
当我打印属性的值时,如果资源可用,则返回 true,否则仅打印属性名称。
如果资源是,有没有办法将属性设置为某个值not可用的?我尝试在可用检查之前显式设置属性,但随后 ant 抱怨:
[available] DEPRECATED - used to override an existing property.
[available] Build file should not reuse the same property name for different values.
您可以将条件与 not 结合使用:
http://ant.apache.org/manual/Tasks/condition.html http://ant.apache.org/manual/Tasks/condition.html
<condition property="fooDoesNotExist">
<not>
<available filepath="path/to/foo"/>
</not>
</condition>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)