There is a great deal of "folklore" knowledge about the individual Ant tasks that is not clear from the specification of the tasks offered in the Ant Manual.
The Sync Task (present since 1.6)
Here is an example of some lore of this type: The Sync task will delete 'dangling files' and 'dangling directories' in the target directory.
The Property Task
The Prefix Attribute
I have to access some properties (from a file), which are already defined in my build file. To be able to access the properties I can use the
prefix attribute of the property task.
Ant Example Target
The AntCall Task
Sometimes on the mailinglists there is a question on how to invoke a special target depending on the value of a property. Because there could be more than two values, you can´t use the usual if/unless-attributes of the target.
But the solution is quite easy: compound the name of the target by a common term and the value itself and let antcall do the job.
Ant Example Target
You have only to ensure, that there are valid values for that property, e.g. a blabla would call the non existing blabla-upload which results in an error. But the input task here will ensure that.
BTW - the same can be used for loading platform specific properties:
The Exec Task
On Windows the Exec task does not find the executable file if its directory was double quoted in the PATH environment variable. (Execute failed ... error 2: which means file not found.)
The Unzip Task
How to unzip the content of a subdirectory of a zip file without the path to the subdirectory. For example, if a zip file has a directory dir1/dir2, how to unzip dir2 into dir3 so that dir3 contains only dir2, not dir1/dir2?
The XSLT Task
This task allows you to perform XML transforms using the built-in XSLT system. XSLT 2.0 can also be done using the Saxon system.
Here is a demonstration UsingAntWithXSLT20AndSaxon.