ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Mawson <>
Subject [PATCH] PropertyFile task.
Date Thu, 01 Jan 1970 00:00:00 GMT

PropertyFile task uses java.util.Properties to modify integer, String and
Date settings in a property file.

The following is an example of it's usage:

    <target name="testPropertyFiles">
    	    value="Copyright 2000 Coporation inc\\This file does some of
this\\and some of that" />

        <propertyFile key="Int" type="int" operation="=" value="681"
file="test.txt" />
        <propertyFile key="IntInc" type="int" operation="+" file="test.txt" />
        <propertyFile key="IntDec" type="int" operation="-" file="test.txt" />
        <propertyFile key="NeverDate" type="date" operation="never"
file="test.txt" />
        <propertyFile key="StringEquals" type="string" value="testValue"
file="test.txt" />
        <propertyFile key="NowDate" type="date" operation="now"
file="test.txt" message ="${COPYRIGHT_MESSAGE}" />

The propertyFile task must have:
    key, type, file
Other parameters are:
    operation, value, message

Parameter values:
        "=" (set -- default)
        "-" (dec)
        "+" (inc)
        "now" (date and time)
        "never" (empty string)


String property types can only use the "=" operation
Date property types can only use the "never" or "now" operations
Int property types can only use the "=", "-" or "+" operations

The message property is used for the property file header, with "\\" being
a newline delimiter charater. (This should be '\n' but I couldn't quite get
it right).

Source attached.

View raw message