This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git

commit 266b7136b17c140382bbdfce2f20a8d91e15de2b
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Thu Oct 29 22:25:22 2026 +0000

    Document that the declared artifact wins regardless of scope
---
 .../shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
 
b/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
index bc4320f..d459809 100644
--- 
a/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
+++ 
b/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
@@ -499,7 +499,9 @@ public class DefaultProjectDependencyAnalyzer implements 
ProjectDependencyAnalyz
     /**
      * Maps each class to the artifact that provides it. When several 
artifacts contain the class, a declared
      * artifact wins over an undeclared one, and otherwise the first one wins. 
If two declared artifacts contain the
-     * class, only the first of them is credited.
+     * class, only the first of them is credited. Scope is not considered: a 
declared test-scoped artifact that
+     * contains the class is credited even for main code, so an undeclared 
compile-scoped artifact with the same
+     * class is not reported as used.
      *
      * @param artifactClassMap the classes of each artifact
      * @param declaredArtifacts the artifacts declared by the project

Reply via email to