Chapter 8. Putting it all together

 

This chapter covers:

  • 8.1 How to write good build files
  • 8.2 Building the diary library
  • 8.3 Adopting Ant
  • 8.4 Building an existing project under Ant
  • 8.5 Summary

We’ve introduced the basic concepts, tasks, and types of Ant. We’ve shown how it reads build files containing targets and tasks, showing Ant what needs to be done to build a project. We’ve looked at Ant’s tasks, targets, properties, and datatypes, and we’ve shown you how to automate the build and compile, test, package, and distribute a Java project. You should now be able to create build files to accomplish the most common build-related tasks, such as <javac>, <copy>, <zip> and <jar>.

What we haven’t shown you is a single build file that incorporates all these things. This chapter provides a higher-level view of our sample application’s build process, reviews the techniques that we’ve already presented, and introduces some new concepts. The first concept is the most important: the art of writing good build files.

8.1. How to write good build files

An Ant build file is meant to automate the process by which you build, test, distribute, and deploy your software. It should not become a maintenance project all of its own. If you spend more time maintaining the build file than writing code, tests, or documentation, something has gone wrong. There are several key ideas that we want to convey with our build file examples.

Begin with the end in mind

8.2. Building the diary library

8.3. Adopting Ant

8.4. Building an existing project under Ant

8.5. Summary

sitemap