i have a variable abc
and had the value this is ant script
. This abc variable will keep on changing.
Using ANT script, how can i write the value out to the file?
Echoes a message to the current loggers and listeners which means System. out unless overridden. A level can be specified, which controls at what logging level the message is filtered at.
This task is used to load file into a property. It works on files and provides a srcFile attribute for ease. It uses default encoding current locale unless other one is specified.
The echo task in ANT is able to write to files
<echo file="output.txt" append="true"> abc=${abc} </echo>
Use propertyfile task. An example taken from ant manual:
<propertyfile file="my.properties">
<entry key="abc" value="${abc}"/>
</propertyfile>
This may be better than echo
as it updates the properties file with a given value, while echo
appends to or overwrites the whole file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With