Dependencies within build files can become very complex and involved. Thankfully, Eric Burke has come up with Antgraph, a very convenient open source utility for graphically viewing Ant build files. Antgraph is available from Eric's Web site at http://www.ericburke.com/downloads/antgraph/. The software is very easy to install and run, and is available for several platforms.
Figure 12-1 shows an example of the output from Antgraph.
Figure 12-1. Ant build file dependency information produced by Antgraph.
The example in Figure 12-1 is a graphical representation of the Ant build file supplied by AndroMDA for producing a Hibernate-based AndroMDA project. The graph depicts each target within the build file, with the arrows showing the calling hierarchy between the targets. The numbers on the arrows are a count of the dependencies for each target. For example, build is dependent on three targets: init, buildjars, and hibernate-schema.
Antgraph relies upon Graphviz, a freely available graphics engine, for rendering the graph. Graphviz supports a number of different graph types, so you can experiment with the different options. The graph shown uses the standard dot layout engine, but other options include the neato and twopi layout engines. You might want to experiment to find your favorite.