ant dependency graphing with graphviz

Main menu:

Topics

Recent Posts

Blog

January 2012
M T W T F S S
« Dec   Feb »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Past Posts

Java/Java EE

JDBC

Other

ant dependency graphing with graphviz

January 19th, 2012 by Jeanne Boyarsky

In 2007, I wrote an article about ant dependency graphing in the JavaRanch Journal.  I had cause to try it again to visualize the FIRST robotics complex build scripts.  This time, I’m on Mac.  At the moment, the MacOS version of Graphviz is in beta.  This isn’t critical so giving it a try.

It was easy to install with a wizard to accept license, choose location, etc.  Installation was successful and less than a minute.

The contenders from 2007

  • Ant2Dot – hasn’t changed since 2007
  • Visant – hasn’t changed since 2002
  • Grand – hasn’t change since 2005

Since there haven’t been any updates, my analysis should still be the same.  Since Grand generated the most useful output then, I went with it.

Grand

<?xml version="1.0"?>
<project name="Grand" basedir="." default="grand">

	<typedef resource="net/ggtools/grand/antlib.xml" classpath="grand-1.8.jar" />

	<target name="grand">
		<grand output="grand-build.dot" buildfile="/Users/nyjeanne/sunspotfrcsdk/build.xml" />
	</target>

</project>

Graphviz

  1. File > Open – choose grand-build.dot
  2. As before, I can navigate around the file.  This time the graph is ugly.  But I was doing this because the build file was so large and complex it was hard to understand so I’m glad I visualized it.
  3. File > Export
Not sure why Graphiz is still in beta; it worked perfectly.  Maybe for more complex operations there are problems?

The image
This series of Ant builds has a really large number of targets and dependencies so it makes for a complicated graph. A snippet is at the top of this post. The full one is available online:
pdf (decent number of bytes – still tiny so you’ll want to soom in and scroll around)
gif (the file is a large – 1MB download – which is why I’m not including it in the main blog entry. It’s also tiny, so you’ll want to zoom in and scroll around)

Write a comment