【发布时间】:2013-04-09 21:33:33
【问题描述】:
我需要 Ant 中的 if-elseif-else 条件语句。
我不想使用 Ant-contrib。
我尝试了解决方案here
<target name="condition.check">
<input message="Please enter something: " addproperty="somethingProp"/>
<condition property="allIsWellBool">
<not>
<equals arg1="${somethingProp}" arg2="" trim="true"/>
</not>
</condition>
</target>
<target name="if" depends="condition.check, else" if="allIsWellBool">
<echo message="if condition executes here"/>
</target>
<target name="else" depends="condition.check" unless="allIsWellBool">
<echo message="else condition executes here"/>
</target>
但我必须在 if 和 else 目标中设置属性,这些属性在调用目标中不可见。
有没有其他使用条件的方法?
【问题讨论】:
标签: ant ant-contrib