If you want a version of <ant> with the logical default of inheritall="false", here it is
wherever you use <better-ant>, it will behave exactly like the <ant> task but with a different default value.
You can also define child elements. Say you want all your <javac> tasks to compile against a set of jars living in
/our/jar/repository/, you could define
and use <my-javac> wherever you'd use <javac> instead.
It is interesting to note that both <presetdef> and <macrodef> dynamically define a task that can then be invoked as any other. Properly declared, the resulting tasks can be used interchangeably. Here is a simple example, in which the
filter target will echo a message either to the console or to a file depending on whether the property
destfile has been set:
Another current use for <presetdef> is to provide a work-around for a bug with the JDK 1.5beta1 javac compiler. The compiler accepts target="1.1" but for some reason this does not work unless one sets source="1.3" as well. As this is a temporary issue one does not want to modify the build script much. This can be achieved as follows:
This will make a new javac task which will call the current javac task with the source option set to 1.3. It will also whine that one is overwritting the javac task.