Chapter 18. Extending Ant further

 

This chapter covers:

  • 18.1 Scripting within Ant
  • 18.2 Conditions
  • 18.3 Writing a custom resource
  • 18.4 Selectors
  • 18.5 Developing a custom mapper
  • 18.6 Implementing a custom filter
  • 18.7 Handling Ant’s input and output
  • 18.8 Embedding Ant
  • 18.9 Summary

We’ve just been extending Ant with custom tasks in Java. Is that all that can be done to adapt it to a project? No, not at all! Some of the other ways that Ant can be extended are by

  • Writing tasks using scripting languages with the <script> and <scriptdef> tasks
  • Writing new conditions for use in <condition>, <fail>, and other tasks
  • Writing custom resources, filters, selectors, and mappers
  • Monitoring the build process with custom build listeners and loggers
  • Embedding Ant inside your own program

We’re going to go through all these extension mechanisms in turn to see what they are and how to write, test, and use them.

In the previous chapter, we looked at writing an Ant task and the Ant API. Although we are extending Ant in different ways in this chapter, everything covered in the previous chapter about Ant’s Java API and how to test tasks is still essential. If you haven’t already done so, read chapter 17.

18.1. Scripting within Ant

18.2. Conditions

18.3. Writing a custom resource

18.4. Selectors

18.5. Developing a custom mapper

18.6. Implementing a custom filter

18.7. Handling Ant’s input and output

18.8. Embedding Ant

18.9. Summary