You are here

Maven POM Visualization

In November 2010, I was getting frustrated with the dependency JSchnizzle has on the free yUML rendering service. It appears that the yUML service is having increasing performance problems as time goes on. Additionally, there were a number of outages towards the end of the year that came when I really needed the service to be available. I wondered, "How difficult would it be to do the renderings locally?"

I did some quick reading up on Graphviz and specifically dot for drawing directed graphs. After doing a little experimenting, I found that I could easily produce class diagrams similar to those generated by yUML. I also found that I was able to recreate the "scruffy" effect by "tweaking" the postscript output generated by dot. Not only could I generate similar diagrams locally, but I could also generate them in a fraction of the time. Unfortunately, more pressing issues demanded my time, so I put the idea of allowing JSchnizzle to do "offline" rendering to the side.

Fast forward to January 31st, 2011. I was thinking about dependencies in one of the Maven projects that I'm working on, and had an idea of processing the pom into a format that could be loaded by JSchnizzle and fed to yUML for rendering. I cranked out a quick Python script to give me the specification to paste into JSchnizzle. Unfortunately, I was doing it for a pretty big project and was not able to get yUML to render it. And then I remembered: I can do the rendering locally using what I learned a few months ago. A few changes to my Python script and I was done. 63 lines of simple Python and I'm able to produce diagrams like the following for a Maven pom:

The Python script can be found here.

I use the following command to run it:

python pomViz.py | dot -Tps | convert -background white -density 100 -geometry 100% - pom.png