chihsuan opened a new issue, #1803:
URL: https://github.com/apache/maven-dependency-plugin/issues/1803

   ### Affected version
   
   3.11.0
   
   ### Bug description
   
   `dependency:go-offline` still resolves artifacts that are excluded on a 
direct dependency. #1350 (MDEP-844) was fixed in 3.9.0 for exclusions declared 
in `<dependencyManagement>`, but an exclusion declared directly on a 
`<dependency>` is still ignored.
   
   Minimal pom:
   
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     
<groupId>x</groupId><artifactId>direct</artifactId><version>1</version><packaging>pom</packaging>
     <dependencies>
       <dependency>
         
<groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.14</version>
         
<exclusions><exclusion><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></exclusion></exclusions>
       </dependency>
     </dependencies>
   </project>
   ```
   
   `mvn org.apache.maven.plugins:maven-dependency-plugin:3.11.0:list` excludes 
`commons-logging` as expected:
   
   ```
   [INFO]    org.apache.httpcomponents:httpclient:jar:4.5.14:compile -- module 
org.apache.httpcomponents.httpclient [auto]
   [INFO]    org.apache.httpcomponents:httpcore:jar:4.4.16:compile -- module 
org.apache.httpcomponents.httpcore [auto]
   [INFO]    commons-codec:commons-codec:jar:1.11:compile -- module 
org.apache.commons.codec [auto]
   ```
   
   `mvn org.apache.maven.plugins:maven-dependency-plugin:3.11.0:go-offline` 
still resolves it:
   
   ```
   [INFO] Resolved dependency: httpclient-4.5.14.jar
   [INFO] Resolved dependency: httpcore-4.4.16.jar
   [INFO] Resolved dependency: commons-logging-1.2.jar
   [INFO] Resolved dependency: commons-codec-1.11.jar
   ```
   
   Results by version:
   
   | Version | Exclusion on direct dependency | Exclusion in 
`<dependencyManagement>` |
   |---|---|---|
   | 3.8.1 | ignored | ignored |
   | 3.9.0 | ignored | honored |
   | 3.11.0 | ignored | honored |
   
   Impact:
   
   - If the excluded artifact does not exist in any repository, 
`dependency:list` succeeds but `go-offline` fails with `The following artifacts 
could not be resolved: ...:jar:1 (absent)`.
   - In Apache Ozone, `go-offline` added three excluded `hadoop-client` jars 
(19M + 19M + 30M) to the CI cache (apache/ozone#12044).
   
   None of the `go-offline` ITs on master declares an exclusion on a project 
dependency. The only one in `mdep-907-go-offline-annotation-processor-paths` is 
on `annotationProcessorPaths`.
   
   Reproduced with Maven 3.9.15 / JDK 17, and with Maven 3.10.0 / JDK 25 on 
GitHub Actions. Not tested on master.
   


-- 
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