Skip to content
janssk1 edited this page Dec 22, 2019 · 23 revisions

About

The maven-dependency-graph plugin generates dependency graphs of a maven project. This can be helpful in identifying unnecessary and unwanted dependencies.

The plugin generates files in graphml format that can be viewed using a tool like http://www.yworks.com/products/yed

Below is a transitive compile dependency graph of the plugin itself

Features

  • By default, generates graphs of all standard maven dependency trees. More info on the standard maven dependency mechanism can be found at http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
    • package: All dependencies that are included in wars/ears/etc. Excludes all provided scoped dependencies.
    • compile: All dependencies used during maven compilation.
    • runtime: All compile time dependencies including runtime scoped dependencies
    • test: All dependencies used during maven testing.
  • Can generate 'transitive' dependency graphs. These dependency graphs do not reflect the actual dependency trees used by maven but are useful to have a single dependency overview of all submodules of a project. In these graphs, dependencies that are normally hidden by maven (such as provided scoped dependencies of nested dependencies) are shown. By default, a transitive compile graph is generated.

Graph format

All graphs generated by the plugin use the same graphml structure.

  • If a selected version is not the same as the declared one, the link is annotated with the declared version.
  • The color of a node depends on the jar size. Big nodes are dark red. Allows to quickly see were big libraries are being used.
  • The size of each node is also included in it's label.

Getting started

Generating a dependency graph should be as easy as

 mvn com.github.janssk1:maven-dependencygraph-plugin:1.5:graph

No modifications to your pom are required. The plugin does require that all dependencies of your project are in your local maven repository. So make sure your project is correctly setup before running the plugin.

You will still need a graphml editor to visualize/layout the graphs.

Configuration

The plugin allows overriding the default list of generated graphs through the graph.reports setting. The following command generates a transitive test graph (not included in the default reports) as well as a package graph.

 mvn com.github.janssk1:maven-dependencygraph-plugin:1.5:graph -Dgraph.reports=PACKAGE,TEST-TRANSITIVE
Clone this wiki locally