tags:

views:

214

answers:

1

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
+2  A: 

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>
Ivan Nevostruev
This looks like what I was after. In the end due to time etc..I choose todo it the using the replace tagse.g.<replace file="/tmp/will.txt" token="@__PRODUCT_VERSION__@" value="newvalue"/>
wmitchell