ANT 脚本处理 exec 的返回值 [英] ANT Script handling Return value from exec
本文介绍了ANT 脚本处理 exec 的返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是场景.我有
<target name="test">
<property file="blah"></property>
<exec dir="" executable="trast.exe" resolveexecutable="true" spawn="true">
</exec>
</target>
<!-- So now I have the second target that uses Return value from first target -->
<target name="test2">
<property file="blah"></property>
<exec dir="" executable=RETURN VALUE resolveexecutable="true" spawn="true">
</exec>
</target>
基本上我需要一种方法来在下一个目标中使用第一个目标的结果.我在网上查看,一种解决方案似乎是解析输出.但是有没有办法不解析就得到它?
Basically I need a way to use the result from first target in the next target. I looked online and one solution seems to be is to parse output. But is there a way to get it without parsing?
谢谢
推荐答案
exec 任务有一个 outputproperty
.你能不能做这样的事情:
The exec task has an outputproperty
. Could you do something like this:
<target name="test">
<exec dir="" executable="trast.exe" resolveexecutable="true" spawn="true" outputproperty="blah">
</exec>
</target>
<!-- So now I have the second target that uses Return value from first target -->
<target name="test2">
<exec dir="" executable="${blah}" resolveexecutable="true" spawn="true">
</exec>
</target>
我使用 Ant 已经有一段时间了,我没有在这台机器上安装它,但我似乎记得做过类似上面的事情.
It's been a while since I used Ant and I don't have it installed on this machine, but I seem to recall doing something like the above.
或者也许使用 resultproperty
?
在这里找到:http://ant.apache.org/manual/Tasks/exec.html
这篇关于ANT 脚本处理 exec 的返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文