Using ant to edit/append data to a text file

10,263

Solution 1

I believe this will work. Testing it now.

<concat append="true" destfile="app.jad">foo: bar</concat>

Solution 2

Another alternative, using the ant echo task

<echo file="app.jad" append="true">hello world
</echo>
Share:
10,263
Andrew Hubbs
Author by

Andrew Hubbs

Updated on July 28, 2022

Comments

  • Andrew Hubbs
    Andrew Hubbs almost 2 years

    I am trying to add a property to a .jad file in my ant build process.

    Is there a task in ant to do this? All I need to do is add a line of text to the end of a text file but I cannot find a task to do this.

  • Andrew Hubbs
    Andrew Hubbs over 13 years
    <concat append="true" destfile="app.jad">foo: bar</concat> Needed to add the append="true" or else it wipes the file and leaves only the added line.