<propertyfile> uses Java's on java.util.Properties to write the file, so comments, except for a one-line header, get removed. This is a frequent annoyance that folks encounter.

But, since you'll be happy with an append, you can do this:

        <echo file="file.properties" append="true">
      prop=${val}
        </echo>

Ant expands ${} property references. You'll need to be sure that the text is appropriate for an .properties file (escaped for special characters and all). And if you need to insert new lines, use ${line.separator} (a JVM system property that Ant makes handy).

Another alternative would be to use a master .properties file with @TOKENS in it and use a filtering <copy> to replace tokens in the copy process.

        Erik


On Feb 27, 2005, at 2:10 AM, Chad Woolley wrote:

Hi,

Does anyone know how to prevent the Ant propertyfile task from randomly rearranging your property file and whacking all the comments?

Or alternately, some simple ant/maven based solution that just lets you append a new property to the end of a file? I tried the replaceregexp task, but I'm not good enough with regexp to know how to append to the EOF.

I know I could write a program/task/plugin to do this, but I can't believe there's nothing out there that I could make work out of the box with a little tweaking...

Many thanks,
Chad

---------------------------------------------------------------------
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