jonathaff opened a new issue, #14155:
URL: https://github.com/apache/maven/issues/14155

   ### Affected version
   
   3.10
   
   ### Bug description
   
   With Maven 3.10.2 (Resolver 2.0.26), the dependency tree selects 
io.grpc:grpc-core:1.8.0 but omits its transitive dependencies after a conflict 
with grpc-core:1.6.1. Tests using classes from those transitives fail with 
ClassNotFoundException.
   Disabling the BF skipper restores the dependencies and makes the tests pass.
   This resembles Maven https://github.com/apache/maven/issues/13430 and 
Resolver https://github.com/apache/maven-resolver/pull/2208, but this 
reproducer uses fixed dependency versions and no version ranges.
   
   Minimal reproducer
   
   The reproducer uses only public dependencies. public-contract is a local POM 
stand-in for the intermediate gRPC contract; it declares the same three gRPC 
1.8.0 dependencies.
   
   `pom.xml`
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>repro.maven</groupId>
     <artifactId>resolver-bf-repro</artifactId>
     <version>1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <modules>
       <module>public-contract</module>
       <module>app</module>
     </modules>
   </project>
   ```
   ---
   `public-contract/pom.xml`
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     <parent>
       <groupId>repro.maven</groupId>
       <artifactId>resolver-bf-repro</artifactId>
       <version>1.0-SNAPSHOT</version>
       <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>public-grpc-contract</artifactId>
     <packaging>pom</packaging>
     <dependencies>
       <dependency>
         <groupId>io.grpc</groupId>
         <artifactId>grpc-stub</artifactId>
         <version>1.8.0</version>
       </dependency>
       <dependency>
         <groupId>io.grpc</groupId>
         <artifactId>grpc-protobuf</artifactId>
         <version>1.8.0</version>
       </dependency>
       <dependency>
         <groupId>io.grpc</groupId>
         <artifactId>grpc-netty</artifactId>
         <version>1.8.0</version>
       </dependency>
     </dependencies>
   </project>
   ```
   ---
   `app/pom.xml`
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     <parent>
       <groupId>repro.maven</groupId>
       <artifactId>resolver-bf-repro</artifactId>
       <version>1.0-SNAPSHOT</version>
       <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>resolver-bf-app</artifactId>
   
     <properties>
       <maven.compiler.release>11</maven.compiler.release>
       <junit.version>5.13.2</junit.version>
     </properties>
   
     <dependencies>
       <dependency>
         <groupId>org.irenical.fetchy</groupId>
         <artifactId>fetchy-connector-grpc</artifactId>
         <version>2.0.10</version>
       </dependency>
       <dependency>
         <groupId>repro.maven</groupId>
         <artifactId>public-grpc-contract</artifactId>
         <version>${project.version}</version>
         <type>pom</type>
       </dependency>
       <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter</artifactId>
         <version>${junit.version}</version>
         <scope>test</scope>
       </dependency>
     </dependencies>
   
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.14.1</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>3.5.3</version>
         </plugin>
       </plugins>
     </build>
   </project>
   ```
   ---
   `app/src/test/java/repro/TransitivesTest.java`
   ```java
   package repro;
   
   import static org.junit.jupiter.api.Assertions.assertNotNull;
   
   import org.junit.jupiter.api.Test;
   
   class TransitivesTest {
       @Test
       void grpcContextIsOnClasspath() throws Exception {
           assertNotNull(Class.forName("io.grpc.Context"));
       }
   
       @Test
       void instrumentationApiIsOnClasspath() throws Exception {
           
assertNotNull(Class.forName("com.google.instrumentation.trace.Tracing"));
       }
   
       @Test
       void openCensusIsOnClasspath() throws Exception {
           assertNotNull(Class.forName("io.opencensus.trace.Tracing"));
       }
   }
   ```
   
   Run and results
   Run from the reactor root:
   `mvn test`
   `mvn -Daether.dependencyCollector.bf.skipper=false test`
   ```
   Maven        Result
   3.9.16       All 3 tests pass
   3.10.2 (Resolver 2.0.26)     All 3 tests fail with ClassNotFoundException
   3.10.2 with BF skipper disabled      All 3 tests pass
   ```
   
   With the default skipper, dependency:tree -Dverbose shows grpc-core:1.8.0 
selected but without its children. With the skipper disabled, its children 
appear, including grpc-context:1.8.0, instrumentation-api:0.4.3, and 
opencensus-api:0.8.0.
   Could this be an uncovered BF-skipper case beyond the version-range scenario 
fixed by #2208?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to