github linkedin
Visualizing the dependencies between Maven modules
2018-03-31

I was looking for (and found) a way to visualize the dependencies between the Maven modules in a multi-module Maven project. In other words: draw a graph with the modules as nodes and the dependencies between them as edges.

I found this plugin. By default it also shows the 3rd party dependencies, so I had to tweak the configuration a little bit.

Running

mvn com.github.ferstl:depgraph-maven-plugin:3.0.1:aggregate -DcreateImage=true -DreduceEdges=false -Dscope=compile "-Dincludes=your.group.id*:*"

will create the file dependency-graph.png in the target folder of your project (make sure to install the dot executable). You need to replace your.group.id in the command with the group id of your project. This makes sure that no 3rd party dependencies are included in the graph.

And because it’s weekend, my girlfriend is in Canada and I want to code some Kotlin, I wrote a small tool to parse the output from mvn dependency:tree and create a PlantUML file from it. Now you can choose to either use the aforementioned plugin or my tool. I published it under GPLv3 and you can find it on GitHub.



Back to posts