gnodet opened a new issue, #813:
URL: https://github.com/apache/maven-shade-plugin/issues/813

   ## Summary
   
   The `dependency-reduced-pom.xml` generated by the shade plugin preserves the 
original POM's `<parent>` element without setting an explicit 
`<relativePath/>`. In Maven 4, this can cause a false parent cycle detection 
error when the default relative path `..` resolves to a POM with a different GA 
that shares the same parent reference.
   
   ## Reproduction
   
   Build any project using the shade plugin with a parent POM, e.g., 
[apache/maven-doxia-converter](https://github.com/apache/maven-doxia-converter):
   
   ```
   mvn package -DskipTests
   ```
   
   With Maven 4, this fails with:
   ```
   [FATAL] The parents form a cycle: org.apache.maven.doxia:doxia-tools:43 ->
     /path/to/project/pom.xml -> org.apache.maven.doxia:doxia-tools:43
     for project [inherited]:doxia-converter:jar:1.4-SNAPSHOT
     at /path/to/project/dependency-reduced-pom.xml
   ```
   
   ## Root cause
   
   The generated `dependency-reduced-pom.xml` inherits the parent element as-is 
from the original POM. Since no `<relativePath/>` is set, Maven defaults to 
`..`, which may resolve to a POM that is not the actual parent. Maven 4's 
stricter model builder detects this as a cycle when the resolved POM shares the 
same parent reference.
   
   ## Proposed fix
   
   When writing the `dependency-reduced-pom.xml`, set `<relativePath/>` (empty) 
in the parent element to explicitly disable local parent resolution. The parent 
should always be resolved from the repository for generated POMs.
   
   ## Workaround
   
   A fix has been submitted for the Maven 4 model builder (apache/maven#12078, 
apache/maven#12079) that detects the GA mismatch early and avoids the false 
cycle. However, setting `<relativePath/>` in the generated POM is the correct 
long-term fix on the plugin side.
   
   ## Environment
   
   - Maven: 4.0.0-rc-2+
   - maven-shade-plugin: 3.6.0 / 3.6.1
   
   Related: apache/maven#12074
   
   _Claude Code on behalf of Guillaume Nodet_


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