Reputation: 328724
I'm struggling with mvn dependency:analyze
. I couldn't get the plugin to work with a reactor build. Instead of recursively building a list of used dependencies, I see unused dependencies per module which is pretty useless. Let's say I have two modules A
and B
where B
depends on A
. A
depend on commons-email
.
The dependency plugin tells me that commons-email
is an "unused declared dependency" of B
which I don't understand: The dependency isn't mentioned in the POM of B
and it's used in A
, so the message is wrong, no matter how I look at it. Also, I don't get this message for A
, so the plugin knows that A
is using the dependency.
On top of that, I get a ton of "used undeclared dependencies" - one warning for each transitive dependency.
Is there a way to configure the dependency plugin to provide some useful information? If not, is there a replacement which can compute a "convex hull" of all the reachable imports?
Upvotes: 4
Views: 754
Reputation: 10905
Regarding the unused declared dependency , you might be inheriting it from a parent pom.
Regarding the used undeclared dependencies for the transitive dependencies : if you directly reference any class from a transitive dependency in a module - e.g. in an import - then the module should declare a direct dependency, even if there is already a transitive dependency . provide versions for all your Use dependency management in your parent pom for all your dependencies instead of declaring the versions over and over again in all of your modules.
Upvotes: 3