build.xml中ant脚本条件 [英] build.xml ant script condition
本文介绍了build.xml中ant脚本条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试着在我的build.xml脚本添加一个条件为我的部署过程。基本上,我需要确定remote.host并根据设定的变量值的主机上。
Im trying to add a condition in my build.xml script for my deployment process. I basically need to determine the remote.host and based on the host set a variable value.
<condition property="my-prop" value="production">
<based on host=1234>
</condition>
<condition property="my-prop" value="development">
<based on host=5678>
</condition>
什么想法?的是如何假设是?
any ideas? of how the is suppose to be?
推荐答案
这应该做的伎俩,猜测你将不得不调整基于机器地址或环境或任何一点。我螺旋桨的值设置为基于对主机性能测试指定的值。
This should do the trick, guessing you will have to tweak a bit based on machine addresses or environment or whatever. Sets the value of my-prop to specified value based on test against the host property.
<!-- <property name="host" value="1234"/> -->
<property name="host" value="5678"/>
<target name="test">
<condition property="my-prop" value="production">
<equals arg1="1234" arg2="${host}"/>
</condition>
<condition property="my-prop" value="development">
<equals arg1="5678" arg2="${host}"/>
</condition>
<echo>${my-prop}</echo>
</target>
这篇关于build.xml中ant脚本条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文