Reputation: 778
We have a multi-module maven project. I have a use case where I want to know to get a list of all the dependencies which is being used in code with version:
Bonus would be if the approach can exclude the deps which are being declared in pom but not being used in the code.
Please suggest the best way to achieve this. TIA.
Upvotes: 1
Views: 1090
Reputation: 14762
There's the Maven Dependency Plugin:
The dependency plugin provides the capability to manipulate artifacts. It can copy and/or unpack artifacts from local or remote repositories to a specified location.
with its tree
goal:
Displays the dependency tree for this project.
Regarding your bonus there's the analyze
goal:
analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared.
and the analyze-only goal:
is the same as analyze, but is meant to be bound in a pom. It does not fork the build and execute test-compile.
Upvotes: 2