concept < presetdef in category ant

appears as: <presetdef
Ant in Action

This is an excerpt from Manning's book Ant in Action.

10.6.1. Redefining tasks with <presetdef>

We’ll start with the <presetdef> task, which is the simpler of the two tasks. It lets you declare a new task based on an existing task. This new task can be used anywhere you would use a normal task and when it’s executed, the task it wraps is invoked. If we were fixing the <exec> task, we could define a new task, <robustExec>, which would set failonerror="true". Whenever we wanted to execute a program, we would declare it with <robustExec> and the failonerror attribute would be set for us. All other attributes and nested elements would still be the same as for the original task. We could even set failonerror="false", in overriding the values set in the template defined with <presetdef>.

When a new task is declared with <presetdef>, the default attributes of a task can be redefined. Any user of the task is free to override these values when they use the task: