6

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/users@maven.apache.org/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"
Alex A
  • 521
  • 1
  • 4
  • 16
  • 1
    If you can create a publicly shareable version of the project showing the problem (remove sources perhaps) then it is an actual testcase that can be submitted to the Maven developers. – Thorbjørn Ravn Andersen Dec 23 '21 at 03:37
  • Check your pom file where you use `https://jcenter.bintray.com` this because that has been closed...that could be the issue...also use more up-to-date version of Maven and check which version of maven-dependency-plugin you are using? – khmarbaise Dec 23 '21 at 07:07

3 Answers3

10

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>
DA.
  • 849
  • 6
  • 19
  • 1
    Note that v3.3.0 is broken as well - it gives empty tree for *war* projects. So upgrade to v3.4.0+ is needed. See https://issues.apache.org/jira/browse/MDEP-806. – Petr Bodnár Apr 03 '23 at 11:58
3

this issue can be recreated with a demo project created with https://start.spring.io/ and selecting spring boot version 2.6.0 or higher without any other dependencies. It does not happen with version 2.5.9

amoor
  • 31
  • 2
  • 1
    the issue with spring-boot can be resolved by replacing the parent element with the spring-boot BOM – amoor Jan 25 '22 at 23:01
  • 2
    can you please explain how this can be done "replacing the parent element with the spring-boot BOM" ? Thanks. – Chris Mar 10 '22 at 16:31
2

This is happening when we use maven-dependency-plugin:3.2.0 version. I tested with version 3.1.2 and the dependency tree is built quickly as usual. BTW.. spring-boot-dependencies >= 2.6.0 are using maven-dependency-plugin:3.2.0 so beware.