I have a complex project with a lot of Maven libraries. From time to time I am facing the problem of a library version conflict. I can open the class which is conflicting and see all libraries a class is packed in. But unfortunately I don't find an easy way to check where these libraries are referenced in the Maven dependencies. Do you have an idea how to find a library in the Maven tree?


You need Maven Helper plugin


It has a dependencies viewer and lets you resolve conflicts right there. Open your pom file after installing the plugin and you will see another tab at the bottom of the editor window.

Right click on any dependency to bring up the context menu and you will see an option to exclude it. It will add exclude to your pom file. That obviously won't work for uberjars.

enter image description here


Going more low-tech, you can let maven tell you the answer with the command

mvn dependency:tree -Dincludes=groupId:artifactId

You can also invoke this command simply from an Intellij terminal window.

mvn dependency:tree will print the entire tree, the includes addition will let you filter on a specific artifact making it easier to search (although I've been known to just copy the entire tree into a scratch file and just do searches on it there).

If you don't know the groupId or the artifactId is already unique enough, you can filter like this:

mvn dependency:tree -Dincludes=*:artifactId

Your Answer

