How do I use properties in ants replace task?
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>
精彩评论