You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/05/18 11:59:41 UTC

[I] Set in dependency-reduced-pom.xml to avoid false parent cycle in Maven 4 [maven-shade-plugin]

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: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Set in dependency-reduced-pom.xml to avoid false parent cycle in Maven 4 [maven-shade-plugin]

Posted by "AzazelSensei (via GitHub)" <gi...@apache.org>.
AzazelSensei commented on issue #813:
URL: https://github.com/apache/maven-shade-plugin/issues/813#issuecomment-5292586464

   Opened # for this.
   The reduced POM now writes an empty relativePath when `..` is not the real parent. Local-only parents keep their path.
   


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Set in dependency-reduced-pom.xml to avoid false parent cycle in Maven 4 [maven-shade-plugin]

Posted by "elharo (via GitHub) via issues" <is...@maven.apache.org>.
elharo closed issue #813: Set <relativePath/> in dependency-reduced-pom.xml to avoid false parent cycle in Maven 4
URL: https://github.com/apache/maven-shade-plugin/issues/813


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org