Skip to content

Fix #13191: add -Dmaven.maven3Personality hint to FATAL message for wrong parent relativePath - #13202

Merged
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13191-shade-relativepath-to-4.0.x
Sep 20, 2026
Merged

gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13191-shade-relativepath-to-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Backport of #13196 to maven-4.0.x.

Summary

Fixes #13191 — improves the FATAL error message when an explicit <relativePath> resolves to a different G:A than the declared parent.

When a POM declares an explicit <relativePath> that resolves to a different G:A than the declared parent, Maven 4 raises a FATAL error. This is correct behaviour — it is a configuration error. However, the error message was unhelpful.

A common cause is maven-shade-plugin generating dependency-reduced-pom.xml with a <relativePath> that is invalid in the generated context (see apache/maven-shade-plugin#813). Users hit a FATAL with no guidance.

Change

Message-only change in mismatchRelativePathAndGA. The FATAL message now mentions:

  • that build tools generating POMs with incorrect <relativePath> (e.g. maven-shade-plugin) should be upgraded
  • -Dmaven.maven3Personality as an explicit temporary workaround

The right fix

apache/maven-shade-plugin#843: emit <relativePath/> in generated POMs.

@gnodet gnodet added this to the 4.0.0-rc-7 milestone Sep 19, 2026
@gnodet gnodet added the bug Something isn't working label Sep 19, 2026
@gnodet
gnodet force-pushed the backport/13191-shade-relativepath-to-4.0.x branch from 12d8e00 to e8e3823 Compare September 19, 2026 20:56
@gnodet gnodet changed the title Fix #13191: add -Dmaven.maven3Personality hint to FATAL message for wrong parent relativePath Fix #13191: add -Dmaven.maven3Personality=true hint to FATAL message for wrong parent relativePath Sep 19, 2026
@gnodet
gnodet force-pushed the backport/13191-shade-relativepath-to-4.0.x branch from e8e3823 to 92a5168 Compare September 19, 2026 20:58
@gnodet gnodet changed the title Fix #13191: add -Dmaven.maven3Personality=true hint to FATAL message for wrong parent relativePath Fix #13191: add -Dmaven.maven3Personality hint to FATAL message for wrong parent relativePath Sep 19, 2026

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean backport of #13196 to maven-4.0.x. Message change is accurate and scoped correctly to the !maven3Mode && !defaultPath branch (explicit <relativePath> pointing at wrong GA). FATAL severity preserved — no behaviour change, only improved diagnostics.

Test testWrongRelativePathInGeneratedPomIsFatalWithMaven3Hint correctly reproduces the shade-plugin scenario: reducedPom has <relativePath>pom.xml</relativePath> resolving to the project's own GA, triggering the FATAL. The three message assertions ("relativePath", "pom.xml", "maven.maven3Personality") all match the actual generated message string. Diff is identical to the master PR.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet merged commit 0db1748 into apache:maven-4.0.x Sep 20, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants