[ https://issues.apache.org/jira/browse/MDEP-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206526#comment-17206526 ]
Elliotte Rusty Harold commented on MDEP-715: -------------------------------------------- A class that exists in two or more dependencies is an error when using Java 9 or later with the Java Platform Module System. From [https://jlbp.dev/JLBP-5] "In Java 9 and later overlapping classes become compile-time and runtime errors when named modules are used. It is critical, especially in Java 9 and later, to remove all but one of the artifacts that contain overlapping classes from the classpath. Generally this requires changing the POMs of multiple Maven artifacts so they no longer include any dependencies on the artifacts you need to remove from your project’s classpath." > Hamcrest used and unused > ------------------------ > > Key: MDEP-715 > URL: https://issues.apache.org/jira/browse/MDEP-715 > Project: Maven Dependency Plugin > Issue Type: Bug > Components: analyze > Reporter: Elliotte Rusty Harold > Priority: Major > Labels: S2, intern > > This is something I've seen when analyzing several Maven plugins. For > example, maven-shared-utils circa July 20, 2020: > > [WARNING] Used undeclared dependencies found: > [WARNING] org.hamcrest:hamcrest:jar:2.2:test > [WARNING] org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:test > [WARNING] Unused declared dependencies found: > [WARNING] org.hamcrest:hamcrest-core:jar:2.2:test > [WARNING] org.apache.maven:maven-core:jar:3.1.0:test > [WARNING] org.codehaus.plexus:plexus-container-default:jar:2.1.0:provided > > Easy fix, right? don't declare org.hamcrest:hamcrest-core:jar:2.2:test and > instead declare org.hamcrest:hamcrest:jar:2.2:test > > But when I do that: > > [WARNING] Used undeclared dependencies found: > [WARNING] org.hamcrest:hamcrest-core:jar:1.3:test > [WARNING] org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:test > [WARNING] Unused declared dependencies found: > [WARNING] org.hamcrest:hamcrest:jar:2.2:test > [WARNING] org.apache.maven:maven-core:jar:3.1.0:test > [WARNING] org.codehaus.plexus:plexus-container-default:jar:2.1.0:provided > > Figure out what's going on here and fix it. Is hamcrest-core needed and used > or not? is hamcrest needed and used or not? Be consistent. > -- This message was sent by Atlassian Jira (v8.3.4#803005)