ant dependency graphing with graphvizJanuary 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.
<?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>
- File > Open – choose grand-build.dot
- 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.
- File > Export
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)