【发布时间】:2010-11-13 01:29:28
【问题描述】:
如何将 Ant 脚本编写为:
... ...
begin of HERE DOCUMENT > ./outfile.txt
xxx
toto
yyy
zzz
end of HERE DOCUMENT
... ...
Of 谁执行创建了一个名为 ./outfile.txt 的文件,其中包含:
xxx
toto
yyy
zzz
【问题讨论】:
如何将 Ant 脚本编写为:
... ...
begin of HERE DOCUMENT > ./outfile.txt
xxx
toto
yyy
zzz
end of HERE DOCUMENT
... ...
Of 谁执行创建了一个名为 ./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}"
/>
【讨论】: