Nic*_*ton 5 java ant build conditional-statements
我想做类似下面的事情
<target name="complex-conditional">
<if>
<exec command= "python some-python-script-that-returns-true-or-false-strings-to-stout.py/>
<then>
<echo message="I did sometheing" />
</then>
<else>
<echo message="I did something else" />
</else>
</if>
</target>
Run Code Online (Sandbox Code Playgroud)
如何评估在 ant 条件语句中执行某些脚本的结果?
该<exec>任务具有outputproperty、errorproperty和resultproperty参数,允许您指定用于存储命令输出/错误/结果代码的属性名称。
然后,您可以在条件语句中使用其中一个(或多个):
<exec command="python some-python-script-that-returns-true-or-false-strings-to-stout.py"
outputproperty="myout" resultproperty="myresult"/>
<if>
<equals arg1="${myresult}" arg2="1" />
<then>
<echo message="I did sometheing" />
</then>
<else>
<echo message="I did something else" />
</else>
</if>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1289 次 |
| 最近记录: |