How to use properties in the task of replacing ants?

I need to replace the token with a property. This property has a set of path locations. I do not get it as it just replaces it with $

<replace file="${APACHE_HOME}/conf/wc_server1.conf" >
  <replacetoken>@Install_Base_Directory@</replacetoken> 
<replacevalue>$InstallerBase</replacevalue>
+2
source share
2 answers

Basically you 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 replaces only one line, use:

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

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

<replacevalue>${InstallerBase}</replacevalue>
+1
source

All Articles