Custom DataTypes

Just as the purpose of a Task is to provide functionality, the purpose of a DataType is to provide state. The result of this separation is increased ability to configure tasks and an increased ability for reuse. Let’s see how we can put this to work to solve the problem of how to specify class and source paths for ClassToSource.

Both the Task class and DataType class share the same abstract super class, ProjectComponent. Subclasses of these two types receive equal treatment by Ant during the configuration pass. The big difference comes in how Ant employs them. As we’ve seen, a Task is designed to carry out a specified unit of work. On the other hand, a DataType is designed to define a configuration parameter to be used by a ...

Get Ant Developer’s Handbook 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.