How to write a variable in to file in ant?

2020-05-20 02:00发布

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?

标签: ant
2条回答
何必那么认真
2楼-- · 2020-05-20 02:29

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.

查看更多
等我变得足够好
3楼-- · 2020-05-20 02:55

The echo task in ANT is able to write to files

<echo file="output.txt" append="true">
   abc=${abc}
</echo>
查看更多
登录 后发表回答