Extending the Task Class
Usually, you extend an
Ant task class like org.apache.tools.ant.Task when you write
custom tasks. Ant comes with a selection of task classes meant to be
extended:
AbstractCvsTaskAbstract CVS task class
JDBCTaskHandles JDBC configuration needed by SQL type tasks
MatchingTaskAbstract task that should be extended by tasks required to include or exclude files based on pattern matching
PackAbstract base class for pack tasks
TaskGeneric task and the one most commonly extended
UnpackAbstract base class for unpacking tasks
The Task class (i.e., org.apache.tools.ant.Task) is used for most of
this chapter, though some samples will use MatchingTask. The methods of the Task class appear in Table 12-2.
Table 12-2. The Task class's methods
Method | Does this |
|---|---|
| Specifies the task should execute. |
| Returns the task's description. |
| Returns the file and location at which the task is supported. |
| Returns the target that contains this task. |
| Returns the wrapper class instance the task uses for runtime configuration. |
| Returns the task name (used when when logging messages from the task). |
| Returns the type of task as a string. |
| Returns the runtime configurable structure for this
task as a |
|