EditProperties is a specialized task for editing a properties file.
The properties file is updated only if it differs from the original file.
Download editproperties.jar from Source Forge and save to your ${ANT_HOME}/lib directory.
Attribute | Description | Required |
file | properties file to be edited. | Yes. |
encoding | The encoding of the properties file. | No - defaults to default JVM encoding |
strict | Tells whether the build should fail if a property is not found. | No - defaults to true. |
editproperty
Attribute | Description | Required |
name | The name of the property to edit. | Yes. |
value | The new value for this property. | No - but should not be used when property is present. |
property | the property holding the new value. | No - but should not be used when value is present. |
commentproperty
Attribute | Description | Required |
name | The name of the property to comment. | Yes. |
<editproperties file="database.properties"> <editproperty name="jdbc.url" value="jdbc:oracle:thin:@localhost:1521:ORADB"/> <editproperty name="jdbc.password" property="my.jdbc.password"/> <commentproperty name="jdbc.options"/> <editproperty name="jdbc.poolsize"/> </editproperties>
In the file database.properties: