蚂蚁条件如果macrodef内 [英] ant conditional if within a macrodef
问题描述
在蚂蚁,我有一个macrodef。
Within ant, i have a macrodef.
假设我已经使用这个macrodef,并且有一个项目里面说macrodef,我要运行当且仅当该属性special.property存在,并且是真实的,我该怎么办?
Assuming i have to use this macrodef, and there is a item inside said macrodef that i want to run iff the property special.property exists and is true, what do i do?
我目前有
<macrodef name="someName">
<sequential>
<someMacroDefThatSetsTheProerty />
<some:thingHereThatDependsOn if="special.property" />
<sequential>
</macrodef>
不工作 - 在一些:thingHereThatDependsOn可是没有如果属性,我不能添加一到它
Which doesn't work - the some:thingHereThatDependsOn doesnt have an "if" attribute, and I cannot add one to it.
antcontrib不可用。
antcontrib is not available.
通过一个目标,我可以给目标一个如果,我可以用macrodef做什么?
With a target I can give the target an "if", what can I do with a macrodef?
推荐答案
这是唯一可能的,如果ANTthingHereThatDependsOn任务支持的如果属性。
This is only possible if the ANT "thingHereThatDependsOn" task supports an "if" attribute.
如上所述,在ANT条件执行,通常仅适用于目标
As stated above, conditional execution in ANT, normally, only applies to targets.
<target name="doSomething" if="allowed.to.do.something">
..
..
</target>
<target name="doSomethingElse" unless="allowed.to.do.something">
..
..
</target>
<target name="go" depends="doSomething,doSomethingElse"/>
这篇关于蚂蚁条件如果macrodef内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!