Reputation: 5725
This should be a simple one. I had another codebase that this worked but for some reason it wont work here at all. My file will.txt is unmodified.
Here is an exerp from my ant build file .. Any ideas Ive wasted hours already banging my head trying to get it to work.
<loadfile
property="config.update.list"
srcFile="config.update.list" failonerror="true">
<filterchain>
<replacetokens>
<token key="__PRODUCT_VERSION__" value="CATTY"/>
</replacetokens>
<striplinebreaks/>
</filterchain>
</loadfile>
<echo>${config.update.list}</echo>
Below is contents of the file config.update list
/tmp/will.txt
Below is the contents of /tmp/will.txt
@__PRODUCT_VERSION__@ will
Upvotes: 0
Views: 1078
Reputation: 28713
From Alexander Pogrebnyak's comment. Attribute srcFile
should point to file name /tmp/will.txt
:
<loadfile
property="config.update.list"
srcFile="/tmp/will.txt" failonerror="true">
Or if file name is stored in this property then you should use srcFile="${config.update.list}"
. Anyway, ant doesn't allow you to change value of the properties. So you can't use property="config.update.list"
for output if it's already set. Try to use other property for output:
<loadfile
property="config.update.list.output"
srcFile="/tmp/will.txt" failonerror="true">
...
<echo>[${config.update.list.output}]</echo>
Upvotes: 2