Creating Standard Ant Targets and What They Should Do

In every project that you do, and in just about every build file that you encounter, certain targets keep popping up. It helps to give these targets standard names so that everyone understands what the task does. Let’s think about what you need to do in most projects. You need to set properties, create directories, compile, test, report on the tests, jar, perhaps war (if it’s a Web app), generate JavaDocs, and deploy. You can name the corresponding targets accordingly. Here is a short list of common target names and what they do:

  • init sets properties for the entire build

  • prepare creates a build directory, test results directory, and so on

  • fetch fetches your source code updates from a source ...

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.