【发布时间】:2016-10-12 23:37:02
【问题描述】:
以下是 Ant 任务示例。
<target name="evalTask">
<condition property="conditionValue" >
<mycustomTask:evaluateCondition/>
</condition>
</target>
<target name="checkAndUpdateFlag" unless="conditionValue">
<property name="isEnabled" value="true"/>
</target>
<target name="targetA" depends="checkAndUpdateFlag" unless="conditionValue">
<echo message="Do something if the conditionValue is set" />
</target>
<target name="targetB">
<echo message=" Value of isEnabled : ${isEnabled} />
</target>
在上面的示例中,目标“evalTask”将设置属性“conditionValue”是我的自定义任务“evalauateCondition 返回true。
只有设置了属性“conditionValue”,目标“targetA”才会被执行。我工作得很好。但是“checkAndUpdateFlag”中的“isEnabled”属性没有设置,或者它永远不会进入“checkAndUpdateFlag”目标,我仍然将“targetB”中的“isEnabled”属性值作为${isEnabled}。基本上永远不会设置“isEnabled”。
下面是我用来运行这个目标的 ant 命令。
蚂蚁目标A 目标B
关于为什么我没有在 targetB 中获得 isEnabled 值的任何建议?
【问题讨论】:
标签: ant