Search code examples
mavenmaven-3maven-dependency-plugin

mvn dependency:tree -Dverbose hangs and never finishes


I have a version conflict in transitive dependencies in my project, and I'm trying to use mvn dependency:tree -Dverbose to find the version conflict. However, whenever I run mvn dependency:tree -Dverbose, it just hangs and never finishes. I tried using the debug mode (mvn --debug dependency:tree -Dverbose) to find out what's going on, and it seems that it's connecting to hundreds and hundreds of repositories, that I have defined nowhere anywhere in my project, writing tracking file, using connector, using transporter, etc...... see the pastebin here for a small snippet of the things that it just does for hours and hours: https://pastebin.com/raw/L3z4u5Hj

This doesn't happen when I don't include the -Dverbose flag: mvn dependency:tree on it's own is super snappy and completes in seconds.

Also, this doesn't happen for any other repositories or codebases that I have: only a specific one. But obviously I don't know what's different about this codebase than the other ones, only that the dependencies are different (assuming that some dependency is the cause of the problem.)

It seems that people on the official maven mailing list ran into this issue too, but it seems they were never able to solve it either: https://www.mail-archive.com/[email protected]/msg143124.html

Any help would be appreciated. If I can't figure this out, I'll have to resort to removing dependencies one by one until I find the one that is causing the problem, and that will take a very long time because this is a very large codebase.

maven version:

Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-54-generic", arch: "amd64", family: "unix"

Solution

  • I had the same problem with my Spring boot project. As pointed out before, the maven-dependency-plugin:3.2.0 seems to be the problem.

    The issue was fixed in version 3.3.0 https://issues.apache.org/jira/browse/MDEP-761

    My fix was to add the new version as plugin to the pom.xml:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.3.0</version>
    </plugin>