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.
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.
If you're running on Linux/Unix you can use the <exec>
task to execute arbitrary shell scripts as follows:
<project name="test">
<target name="append">
<exec executable="/bin/bash">
<arg value="-c"/>
<arg value="echo HELLO >> app.jad"/>
</exec>
</target>
</project>
Running ant append
will append "HELLO" to the file app.jad
in this case.
Under Windows you need to invoke cmd
instead:
<project name="test">
<target name="append">
<exec executable="cmd">
<arg value="/c"/>
<arg value="echo HELLO >> app.jad"/>
</exec>
</target>
</project>
The -c
and /c
switches are important since this tells the shell to interpret the remainder of the command line as a single command to execute.
I believe this will work. Testing it now.
<concat append="true" destfile="app.jad">foo: bar</concat>
Another alternative, using the ant echo task
<echo file="app.jad" append="true">hello world
</echo>