O'Reilly logo

Ant: The Definitive Guide by Jesse Tilly, Eric M. Burke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Ant’s Task Model

Understanding custom tasks means understanding the task model. Ant, being a Java-based program, uses Java’s class hierarchy and reflection capabilities to perform its duties. All Ant tasks derive, directly or indirectly, from the abstract class org.apache.tools.ant.Task. The Ant engine manages all task objects at this level, manipulating only Task objects. For the engine, every task derives from the same class and has the same core methods and properties as every other task. The combination of XML parsing and a method-naming scheme allows Ant to use all of Task’s subclasses. Additionally, Ant processes tasks in a fixed manner — in other words, Ant processes every task in a cycle. While understanding this model and process in detail is not a requirement to writing simple tasks, complex tasks may exhibit undesirable behaviors unless you understand the entire task model and execution process.

The Parts of a Task

A task has two faces. To an Ant end user, a task is nothing more than the XML in a buildfile. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required