I am having trouble writing a property that contains the value of the directory path in the properties file.
My script initially reads in this particular property, calls it "appserver.home" from the props with <property file="source.props"/>. I repeated the value included in it and it reads correctly, like C: \\ somedir \\ jboss_4_2_3.
What my next script should execute is the value for another properties file (used by another ant script - although this is not important). To create this other file, I use a kind template file with place owners surrounded by $ .... $ to insert the correct values in the right place using the following: -
<copy file="template_file.props" tofile="target.props">
<filterset begintoken="$" endtoken="$">
<filter token="appServerDir" value="${appserver.home}"/>
<filter token="dbusername" value="${database.name}"/>
....
</filterset>
</copy>
The problem is that now the value in target.props is C: \ somedir \ jboss_4_2_3, i.e. it has lost escape characters. When the following ant script uses this file, it interprets the property value as C: somedirjboss_4_2_3.
So the question is, how can I tell ant that the value I am writing is a file path? Note. I tried the following, which actually works: -
<propertyfile file="target.props">
<entry key="appServerDir" value="${appserver.home}"/>
</propertyfile>
.. i.e. displays the name as c \: \\ somedir \\ jboss4_2_3, but I would rather not use this method and, rather, use the template file technique, since it contains some properties that are always static, as well as comments, etc.
Thanks in advance
source
share