如何将 Ant 脚本编写为:
... ...
begin of HERE DOCUMENT > ./outfile.txt
xxx
toto
yyy
zzz
end of HERE DOCUMENT
... ...
Of Who 执行会创建一个名为 ./outfile.txt 的文件,其中包含:
xxx
toto
yyy
zzz
如果文件的内容是REPLACE_ME,则运行此任务将执行此操作:
<!-- Create the file -->
<concat destfile="outfile.txt">REPLACE_ME</concat>
<!-- This property is initialized reading user input -->
<input
message="Please enter file content:"
addproperty="file_content"
/>
<!-- Replace the property value inside the file -->
<replace
file="outfile.txt"
token="REPLACE_ME"
value="${file_content}"
/>