Chapter 5. User-Written Tasks

The concept of extending Ant through customization has been and still is its most important and acclaimed feature. The creators of Ant provide us with a system robust enough to work with the languages and tools available today and the ability to grow and work with the languages and tools of tomorrow. For example, tasks exist for working with the C# language, which did not exist when Ant first appeared in early 2000. Users have written tasks for working with third-party tools from groupware products, such as StarTeam (a version control system), to application servers such as BEA’s WebLogic or the JBoss Group’s JBoss. These changes and improvements came about with little or no changes to Ant’s core processing engine. Extending Ant without modifying its core engine is very important because it means the core Ant engine can be improved and modified separately from extension development. Development in both areas is done concurrently, resulting in modifications being made faster than had Ant been a monolithic system.

All Ant tasks are Java classes, and any programmer can extend the functionality of Ant by writing a new Java task class. These are user-written tasks, and take advantage of the same interface to Ant used by the core tasks shipped with an Ant distribution. The only differences between a user-written task and a core task are the author and the package location of the task (and sometimes that’s the same!). Otherwise, they both function on ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.