Adding Nested Elements to a Custom Task

In previous chapters, you’ve seen that nested elements are used by many Ant tasks. Nested elements help simplify the definition of complex attributes. For example, the javac task requires both sourcepath and classpath attributes. In providing us with a simpler means to express a complex attributes, Ant enables us to improve the readability of the build script. As we all know, improving readability goes a long way toward improving maintainability.

As is the case with the javac task, the ClassToSource task requires us to specify both a sourcepath and a classpath. We’ve already seen how javac has benefited from the use of nested elements. It seems only sensible that ClassToSource would also benefit from the ...

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.