How to write a variable in to file in ant?

后端 未结 2 1615
南方客
南方客 2021-02-01 15:37

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

相关标签:
2条回答
  • 2021-02-01 16:24

    The echo task in ANT is able to write to files

    <echo file="output.txt" append="true">
       abc=${abc}
    </echo>
    
    0 讨论(0)
  • 2021-02-01 16:30

    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.

    0 讨论(0)
提交回复
热议问题