Skip to content

Nested property interpolation in distributionManagement fails validation in Maven 4 #12075

@gnodet

Description

@gnodet

Summary

Maven 4 rejects POMs that use chained property references in <distributionManagement> IDs. The first level of interpolation resolves, but the second level is still a ${...} expression when the validator runs, causing a failure.

Reproduction

Build apache/ratis with Maven 4:

mvn package -DskipTests

Expected

Build succeeds (as it does with Maven 3). All properties resolve through the chain.

Actual

[ERROR] 'distributionManagement.repository.[${distMgmtReleasesId}].id' contains an uninterpolated expression. @ line 37, column 7
[ERROR] 'distributionManagement.snapshotRepository.[${distMgmtSnapshotsId}].id' contains an uninterpolated expression. @ line 42, column 7

Root Cause

Ratis defines a layer of indirection on top of the Apache parent POM's distributionManagement properties:

Apache parent POM (org.apache:apache:38):

<properties>
    <distMgmtReleasesId>apache.releases.https</distMgmtReleasesId>
</properties>
<distributionManagement>
    <repository>
        <id>${distMgmtReleasesId}</id>
    </repository>
</distributionManagement>

Ratis POM overrides distributionManagement with staging properties:

<properties>
    <distMgmtStagingId>${distMgmtReleasesId}</distMgmtStagingId>
</properties>
<distributionManagement>
    <repository>
        <id>${distMgmtStagingId}</id>
    </repository>
</distributionManagement>

The interpolation chain is: ${distMgmtStagingId}${distMgmtReleasesId}apache.releases.https

Maven 4's validator runs after the first interpolation pass, sees ${distMgmtReleasesId} (partially resolved), and rejects it. Maven 3 fully interpolates all nested properties before validation.

Impact

Only affects projects that add an extra indirection layer over the Apache parent's distributionManagement properties. Currently only ratis is affected in our test suite of ~960 Apache repositories.

Environment

  • Maven: 4.0.0-SNAPSHOT (branch maven-4.0.x-test-fixes)
  • Java: 17.0.18 (Eclipse Adoptium)

Test results: gnodet/maven4-testing#9934

Claude Code on behalf of Guillaume Nodet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions