concept Java task in category ant

appears as: Java task, Java tasks, Java tasks
Ant in Action

This is an excerpt from Manning's book Ant in Action.

The trouble with this approach is that it assumes that the type of the task <java> will always be that of the Java task, org.apache.tools.ant.tasks.Java. The moment someone uses <presetdef> to redefine the <java> task, (perhaps to give it a new default), its type changes, breaking code inside other tasks. Ant itself had to undergo a major cleanup once this problem was noticed. Current code just creates an instance and then configures it.

Delegating to the Java task

After all the path setup, delegating to the Java task is surprisingly simple. The entire execute() method fits into about 15 lines of code: