I'm trying to find a command that does the opposite of mvn dependency:tree
. I want to find out all the projects that depend on a specific module. As trivial as it may sound, I couldn't find such thing.
The use case is in order to find, in a very large project, if I can delete a module or if there are other modules that use it as their dependency.
First go to View → Tool Windows → Maven, to make sure that the Maven window is visible. The top-level elements in the tree are your direct dependencies, and the child elements are the transitive dependencies.
In your project's POM, press Ctrl and hover the mouse over the dependency. Click the dependency to open the dependency's POM. In the dependency POM, view the active dependency, its transitive dependencies and their versions. You can check the origin from which the dependency was pulled in.
A reverse dependency – meaning another package depends on the existence of your package Note – Use the reverse dependency type only when a package that cannot deliver a depend file relies on your package. An incompatible package – meaning your package is incompatible with the named package.
Try this:
mvn dependency:tree -Dincludes=module
Where module
is the dependency you're interested in. You should get the list of libraries that depend on the module you've specified, either directly or transitively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With