Thursday, January 25, 2007

Dependency graph for maven 2

When more and more maven modules are added to a project, it's sometimes useful to see a graph showing the dependencies between all modules. This can be done with the EL4J maven depgraph plugin. I think the quickest way to show the benefits is by showing its output when applied on itself:





There are 2 modes of the plugin: one shows the dependencies of all the modules in a project. The other mode just shows the dependencies of the currently active directory. You can filter the modules to include. The output is then processed with the graphviz tool.

For more info on the plugin I refer to the code (the global website has not yet been re-generated with the new plugins):

http://svn.sourceforge.net/viewvc/el4j/trunk/el4j/maven/plugins/maven-depgraph-plugin/

And while I am at it, we also have a maven database plugin that allows executing SQL scripts and (optionally) launching an embedded database. More details can be found under http://svn.sourceforge.net/viewvc/el4j/trunk/el4j/maven/plugins/maven-database-plugin/

2 comments:

Erik van Oosten said...

Very nice Phil!

How can I get each and every dependency? Some are missing, and not all dependency arrows are drawn.

Phil said...

Hello Erik

Thank you.

Are you speaking of the missing child->parent dependencies? They were left out to make the graph output more readable.

You can use the depgraph.filterEmptyArtifacts property to eliminate the unconnected artifacts from the graph.

Otherwise (in case you would like to have the child->parent dependencies) it would require a patch.