tags:

views:

64

answers:

2

How to write an Ant script as:

... ...
begin of HERE DOCUMENT > ./outfile.txt
xxx
toto
yyy
zzz
end of HERE DOCUMENT
... ...

Of Whom the execution creates a file called ./outfile.txt Whom contains:

xxx
toto
yyy
zzz
A: 

Ant does not have this feature

Michael Donohue
+1  A: 

If the file's content is REPLACE_ME, then running this tasks will do it:

<!-- 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}"
/>
rodrigoap