Search code examples
mavenintellij-ideamaven-3

How can I debug maven dependency problems when mvn dependency-tree doesn't work?


I am trying to figure out why IntelliJ is using the wrong version (8.1.1 instead of 8.1.2) of one of my project's Java files. The IntelliJ project is a maven project with many dependencies.

To debug, I tried to use the following from the command line:

mvn dependency:tree -Dverbose -Dincludes=jaffa-ria

per the documentation on Maven's site. I see a lot of output about downloading, including some for the jaffa-ria package:

Downloaded: https://nexus/content/groups/public/org/jaffa/jaffa-ria/8.1.2-SNAPSHOT/maven-metadata.xml (941 B at 3.2 kB/s)

However, I don't get any dependency tree printed whatsoever. The mvn command completes normally with a BUILD SUCCESS, and I only see one warning:

[WARNING] Using Maven 2 dependency tree to get verbose output,
 which may be inconsistent with actual Maven 3 resolution

What can I do to find the dependency conflict? I am using Apache Maven 3.5.0. and Intellij IDEA Ultimate 2019.1.


Solution

  • Use Maven Helper plugin for IntelliJ or maven-enforcer-plugin with dependencyConvergence rule.

    maven-dependency-plugin no longer supports displaying conflicts since version 3.0, and as the warning says, older version may be inconsistent with actual Maven 3 resolution.