maven-dependency-plugin icon indicating copy to clipboard operation
maven-dependency-plugin copied to clipboard

[MDEP-646] mvn dependency:analyze mistakenly treat backward compatible classes as used undeclared

Open jira-importer opened this issue 6 years ago • 1 comments

John Lin opened MDEP-646 and commented

I have the following dependency in my pom.xml:

<dependency>
  <groupId>org.apache.cassandra</groupId>
  <artifactId>cassandra-all</artifactId>
  <version>2.1.8</version>
</dependency>

Then a piece of code in my app:

import java.util.concurrent.ConcurrentHashMap;

public class App {
    public void foo () {
        ConcurrentHashMap<String, String> m = new ConcurrentHashMap<>();
        ...
    }
}

Then mvn dependency:analyze will find a used undeclared dependency:

[WARNING] Used undeclared dependencies found:
[WARNING]    com.boundary:high-scale-lib:jar:1.0.6:compile

It turns out that cassandra-all has a dependency on high-scale-lib, and high-scale-lib implemented a java.util.concurrent.ConcurrentHashMap for backward compatibility.

In fact, my app use the built-in ConcurrentHashMap in JDK, not the ConcurrentHashMap from high-scale-lib. So I believe that it is incorrect for the dependency analysis to report it as used.


Affects: 3.1.1

jira-importer avatar Apr 03 '19 03:04 jira-importer

Slawomir Jaranowski commented

Please someone retest with the latest version.

jira-importer avatar Aug 28 '22 11:08 jira-importer