Using PropertyFile task we can edit the property file during ANT build.
Edit property value are very easy and can find here details.
http://ant.apache.org/manual/Tasks/propertyfile.html
but delete a property or comment a property is the tricky one.
If we are using latest ant version (1.8.1 or later), we can delete a property like below.
<propertyfile file="my.properties" comment="My properties">
<entry key="propertykey" operation="del"/>
</propertyfile>
but the older version that is before 1.8.1 don't have operation called "del", if we run the command in lower version ant, we will get a error says undefined operation "del".
there is workaround instead deleting a property we can comment that property using ant's replace command.
<replace file="sample.properties">
<replacefilter token="propertykey" value="#propertykey "/>
< /replace>
Comments
Post a Comment