Name

propertyfile

Synopsis

Creates or edits Java properties files. This task can add and edit entries. It does not preserve existing properties file comments.

Attributes

comment (1.3, 1.4, String, N)

A comment to add to the properties file.

file (1.3, 1.4, File, Y)

The name of the properties file to create or modify.

Content

0..n nested <entry> elements (1.3, 1.4)

Each entry defines a name-value pair to write to or modify in the properties file. The following attributes are supported:

default (1.3, 1.4, String, N)

Initial value for a property if it is not already defined. For a date type, the value may also be set to now or never to indicate the current time or a null time respectively. Perhaps surprisingly, if a property does not exist and both default and value are specified, value is assigned to the property rather than default.

key (1.3, 1.4, String, Y)

The property name.

operation (1.3, 1.4, Enum, N)

Controls how the value attribute modifies the property value indicated by the key attribute. One of + or = for all data types, and also - for date and int types. + performs addition, = performs assignment, and - performs subtraction.

pattern (1.3, 1.4, String, N)

Controls how date and int types are formatted. Uses SimpleDateFormat and DecimalFormat, respectively.

type (1.3, 1.4, Enum, N)

Legal values are int, date, and string. Defaults to string.

value (1.3, 1.4, String, Y)

Specifies a value to add, subtract, or assign to/from the property specified by key. Works with the operation attribute. ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.