ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: creating files
Date Mon, 11 Jun 2007 10:49:40 GMT
arijit wrote:
> i tried out  "<replace file="abc.bat" token="VARIABLE" value="version"/>"
> 
> it worked perfectly replacing VARIABLE with version. But my next task is to
> read the value from some property file instead of typing in the value as
> shown above.
> 
> i will also try out Gilbert's suggestion to load the property value and
> retrieve using key-value pair. 
> 
> 

>>
> 

I usually have a special copy task that expands every ${something} 
property in a file:

     <presetdef name="expandingcopy">
       <copy overwrite="true">
         <filterchain>
           <expandproperties/>
         </filterchain>
       </copy>
     </presetdef>

use this whenever I want to fill in a file with ant properties:

     <expandingcopy todir="${rpm.SPECS}" >
       <fileset dir="${rpm.metadata.dir}" includes="**/*.spec"/>
     </expandingcopy>

By setting overwrite=true you guarantee the copy always takes place, 
which forces all downstream work to be rebuilt too. Apart from that, it 
works very well

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message