Saturday, 23 June 2007

Maven depgraph plugin: getting a better picture of your Maven dependencies

Dependency management has always been a beeyotch, and it's only gotten
worse over the years. This library needs that and that and that
library, and another jar needs that and that jar. Then you could get
one jar depending on an older version of another jar, and another
requiring a newer one. God knows this leads to simple webapps that
only have 4 classes but so many dependencies that they balloon to 14Mb
.war files!

Maven has been a big help in managing this, but the introduction of
transitive dependencies in Maven2 has also resulted in the developer
knowing even less about what libraries are being used. Granted, the
whole thing saves you from having to specify each and every one of
those dependencies, but the fact you had to do it also meant you at
least *knew* what was going in there. And if there were any errors due
to conflicting library versions, you didn't have to trawl through as
many directories to find out what the conflict was. In Maven2, this
pretty much means you have to go through the .pom files in your
repository, whereas in Maven 1 you just had to look in your project's

Anyway, I came across this blog post about a maven plugin that
generates a diagram showing your maven dependencies:

It uses the very useful GraphViz ( to create
the images.

It should be as easy as running:

mvn depgraph:depgraph

Sadly, I couldn't get it to work on my PC. Looks like there's a
parameter you pass in so the plugin knows your local repository -
which is kinda strange, since shouldn't it be able to get this from
Maven, which obviously *would* already have this information? The
parameter "m_localRepository" is a required parameter but the plugin
site (
lacks examples of the proper usage. I mucked around and *seemed* to
get it working with a call to:

mvn depgraph:depgraph -Dm_localRepository="C:\localrepository"

But again, that didn't work. One of these days I'll get it working,
but looming deadlines require my attention on more immediate things to



Marion said...

Did you manage to make it work?

krangsquared said...

Sorry Marion, I gave up and didn't follow up on it. I'll make another post if I get this thing working.

swisswheel said...


Have a look at this post: