开发者

How do I use properties in ants replace task?

开发者 https://www.devze.com 2023-02-15 09:33 出处:网络
I need to replace a token with a property. That property has a path location set. I am not getting it as it is just replacing it with the $

I need to replace a token with a property. That property has a path location set. I am not getting it as it is just replacing it with the $

<replace file="${APACHE_HOME}/开发者_如何转开发conf/wc_server1.conf" >
  <replacetoken>@Install_Base_Directory@</replacetoken> 
<replacevalue>$InstallerBase</replacevalue>


You basically have two options:

<replace file="${APACHE_HOME}/conf/wc_server1.conf" >
  <replacetoken><![CDATA[@Install_Base_Directory@]]></replacetoken> 
  <replacevalue><![CDATA[$InstallerBase]]></replacevalue>
</replace>

or since it's only a single line replace, use:

<replace file="${APACHE_HOME}/conf/wc_server1.conf" 
  token="@Install_Base_Directory@"
  value="$InstallerBase" />


When using Ant properties you must enclose the property name in curlies {...} to get at the value:

<replacevalue>${InstallerBase}</replacevalue>
0

精彩评论

暂无评论...
验证码 换一张
取 消