Use the "replace" task, it does exactly that.

Here's an example from one of my macrodefs:

<replace dir="@{target}" includes="@{includes}" excludes="@{excludes}" [EMAIL PROTECTED]" summary="yes" casesensitive="@{casesensitive}"/>

@{target} is the target directory to replace
@{includes} is the pattern set to match (typically, you do not want to include binaries or jar files
@{file} is the file with the properties
@{casesensitive} what you'd expect.

Hope this fits your needs.

Douglas Bullard

On Apr 7, 2008, at 16:25, coltsith wrote:


Hi,

I have a file of string properties and I need to be able to insert ant
properties into it where referenced. So, for example:

#########
text.file
#########
app.version=${version}
app.name=${name}
app.author=John Doe

#########
props.file
#########
version=4
name=My Application

I need a task or way to provide a property file and replace all occurrences with the corresponding property in a given text file. So a command like
this:

<replacePropertiesInFile file="text.file" propertyDefinitions="props.file"/>

Is there anything like this?

Thanks in advance!
--
View this message in context: 
http://www.nabble.com/How-to-insert-properties-into-a-file--tp16542616p16542616.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to