An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Visualizing ant build.xml files

January 27, 2010 · 3 Comments

I've spent today working on a reasonably complex build.xml file, refactoring it to reduce duplication by using the ant-contrib foreach task so that similar targets can be reduced to loops over a list of properties (I'll blog on that later since it includes some fancy nested loops to run Selenium tests across multiple applications on a server). I wanted a way to look at the structure of the ant file before I did open-heart surgery on it. Google led me to ant2dot and GraphViz (with a very nice version for Mac OS X and the iPhone). It's a very neat way to quickly get a handle on the dependencies in your ant file and it's certainly helped me figure out how to reorganize things. My only complaint would be that it doesn't understand the ant-contrib foreach task which has a target attribute and therefore creates a dependency so such children appear as orphans. I figured I'd blog this in case anyone else finds it useful!

Tags: oss · programming

3 responses so far ↓

  • 1 Martijn van der Woud // Jan 28, 2010 at 12:44 AM

    Nice one Sean! I will certainly check this out for my upcoming CFUG-NL preso on build automation with Ant.
  • 2 Jim Priest // Jan 28, 2010 at 5:58 AM

    I've used Ant Explorer in the past but it seems like that is no longer being updated.

    I've added these and a few more to my Ant wiki: http://www.thecrumb.com/wiki/ant
  • 3 Brian // Jan 28, 2010 at 7:19 AM

    Although not as details as ant2dot, I've always found the outline view using the Ant Editor in Eclipse helpful.

Leave a Comment

Leave this field empty: