Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
creating files

creating files

2007-06-11       - By Steve Loughran
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

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">

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

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

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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.