Skip to content

maven-shade-plugin: dependency-reduced-pom.xml triggers FATAL parent.relativePath error in Maven 4 #13191

Closed

Description

@gnodet

Summary

maven-shade-plugin generates a dependency-reduced-pom.xml with <relativePath>pom.xml</relativePath> in the parent section. When Maven 4 processes this generated POM (e.g. during the shade goal itself or downstream artifact resolution), it evaluates the relativePath, finds it resolves to the same project (not the declared parent), and raises a [FATAL] error.

Maven 3 was lenient in this case (WARNING-level or ignored).

Reproduction

Affected project (found in maven4-testing rc-6 run):

Error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.6.1:shade (default)
        on project org.apache.sling.models.impl: Error creating shaded jar:
        Encountered 1 problem(s) while processing the POMs:
[ERROR]     - [FATAL] 'parent.relativePath' of POM org.apache.sling:org.apache.sling.models.impl:2.0.3-SNAPSHOT
        (/home/runner/work/.../dependency-reduced-pom.xml) points at 'pom.xml' which resolves to
        org.apache.sling:org.apache.sling.models.impl instead of the declared parent
        org.apache.sling:sling-bundle-parent. Correct the <relativePath> value or remove it to let
        Maven resolve the parent from the repository.

Root cause

The dependency-reduced-pom.xml generated by maven-shade-plugin contains:

<parent>
  ...
  <relativePath>pom.xml</relativePath>
</parent>

This is a generated synthetic POM — the relativePath is left over from the original POM transformation. Maven 4's parent POM resolution is stricter: when relativePath resolves to the project itself (same groupId:artifactId), it is now a [FATAL] error instead of a warning.

Expected behavior

Either:

  1. maven-shade-plugin should strip or fix the <relativePath> in the generated dependency-reduced-pom.xml, OR
  2. Maven 4 should apply WARNING (not FATAL) severity when a generated/synthetic POM has an incorrect relativePath, similar to Maven 3 behavior.

Maven version

Maven 4.0.0-rc-6 / maven-4.0.x branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions