Search code examples
mavendependencies

Find dependant (reverse dependencies) in maven project


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.


Solution

  • 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.