Apache Software Foundation / Maven Core
Merged upstreamCorrectnessMerged Aug 26, 2026

Use active profile properties during consumer POM validation

Fixed Maven 4 consumer POM rebuilding so model validation can resolve dependency versions from profiles already active on the project.

apache/maven · #12684

Build correctness fix

Maven consumer POM validation now resolves dependency versions supplied by profiles that were active for the project build.

Problem

`BUILD_CONSUMER` did not reapply properties from the project's active profiles. Model validation could therefore reject a dependency version expression even though the same profile had supplied the value during the successful project build.

Approach

Made active-profile properties available while rebuilding the consumer model, then applied session user properties afterward to preserve their existing precedence. The generated consumer POM retains its profile and expression instead of flattening them.

Impact and scope

  • Prevents valid Maven 4 projects from failing installation when dependency versions come from active profile properties.
  • Preserves user-property precedence and avoids activating profiles that were not part of the original build.
  • Keeps the generated consumer POM faithful to the source model instead of replacing profile-backed expressions.

Validation

  • Added unit coverage for consumer POM property resolution and a Core IT for an `activeByDefault` profile.
  • The regression test verifies successful installation while retaining the profile and property expression in the generated POM.
  • Received three maintainer approvals; the final upstream merge commit is GitHub-verified and credits Goutam Adwant.