Reputation: 721
Is there a way to have a Maven dependency graph of a given set of projects (if possible, graphical), without having 3rd party dependencies drawn too? Or where I opt out the dependencies I'm not interested in?
I'd like to point the tool/plugin at a number of POM files and see a description of the dependencies between those projects.
Upvotes: 61
Views: 75270
Reputation: 612
You can use POM2RDF to generate an RDF graph of your project dependencies (and their dependencies, and so on) that you can then query to get a Software Bill of Materials or visualize as a dependency graph.
Disclaimer: I'm the author.
Upvotes: 2
Reputation: 944
I like depgraph-maven-plugin to visualize dependencies in a multi-module project, see also previous answer.
To get an aggregated result in text format (like dependency:tree
) for your modules, use:
mvn com.github.ferstl:depgraph-maven-plugin:aggregate -DgraphFormat=text -Dincludes=myGroupId
The syntax for includes is the same as with maven-dependency-plugin includes.
It has a lot of properties to customize the result/behavior. I prefer to use it together with graphviz, so I can use the (default) graph format dot
and let it create a png
file in the target
folder:
mvn com.github.ferstl:depgraph-maven-plugin:aggregate -DcreateImage -Dincludes=myGroupId
There are also other interesting goals, e.g. an example
goal to quickly play around with the properties.
Upvotes: 8
Reputation: 2051
mvn com.github.ferstl:depgraph-maven-plugin:aggregate -Dincludes=com.yourcompany.pkg
Does well for me.
Upvotes: 14
Reputation: 1004
there exists exactly what you need, it is called Pom Explorer.
You can find the website here : github.com/ltearno/pom-explorer
It is a tool to work on a graph of maven projects. As a teaser i can say that on my machine it analyzes 4000 pom.xml files in 4 seconds. Then many functionnalities are provided above the analysed pom graph :
It is in active development right now so don't hesitate to try it, report bugs and ask for useful features ! The documentation is also not complete yet, so again don't hesitate to ask !
Thanks
Upvotes: 34
Reputation: 69339
If you use mvn dependency:tree
, you can specify files to exclude or include with -Dexcludes
and -Dincludes
. The output is an ASCII-art style depiction of the dependencies.
See the docs for more info.
Upvotes: 52