Skip to content

Fix #11920: skip expression validation for profile repository URLs#12047

Merged
gnodet merged 1 commit into
masterfrom
ci-issue-11920
May 14, 2026
Merged

Fix #11920: skip expression validation for profile repository URLs#12047
gnodet merged 1 commit into
masterfrom
ci-issue-11920

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 13, 2026

Summary

  • Skip uninterpolated expression validation for repository URLs and IDs inside profiles during raw model validation
  • Profile properties are injected after raw model validation, so expressions like ${asf.staging} or ${env.MAVEN_MIRROR_URL} defined in profile properties/activation cannot be resolved at this stage
  • Top-level repositories and distribution management repositories continue to be validated

Test plan

  • Added test POM profile-with-property-in-repository-url.xml reproducing the Spark POM pattern (env var in profile repo URL + profile properties in plugin repo URLs)
  • Added unit test profileWithPropertyInRepositoryUrl verifying no validation errors
  • Existing tests for uninterpolated expressions in top-level repositories still pass
  • Full module test suite passes (462 tests, 0 failures)

Closes #11920

🤖 Generated with Claude Code

Claude Code on behalf of Guillaume Nodet

Profile properties are injected after raw model validation, so
expressions in profile repository URLs/IDs cannot be validated at
this stage. Skip the uninterpolated expression check for repositories
inside profiles to allow deferred property interpolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-6 milestone May 13, 2026
@hboutemy
Copy link
Copy Markdown
Member

do we know where/when/why the change was introduced?
checking history is part of clarity I'm checking by hand on such cases, having that in the typical automated description could be nice

@hboutemy
Copy link
Copy Markdown
Member

hboutemy commented May 14, 2026

seems it was part of #11140 backported to / introduced in 4.0.0-rc5
what is not clear to me is the comment in the reporting issue:

Maven 4.0.0-rc-5 reports the following error which is not reproducible by Maven 3.x

in Maven 3.x, there was no report, but was there interpolation? or just silent raw un-interpolated value?

@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented May 14, 2026

The uninterpolated expression validation was introduced in #11140 (commit 210dbdc, Oct 2025), backported to 4.0.x via #11210 — which landed in rc-5. The goal was to allow repository URL interpolation during model building and validate that all expressions are resolved afterward.

The problem is that this validation runs at the raw model stage (validateRawModel), where profile properties haven't been injected yet. For top-level repositories, the interpolation in readFileModel() resolves expressions using getEnhancedProperties() (which includes active profile properties). But for repositories inside inactive profiles — like maven-mirror activated by env.MAVEN_MIRROR_URL, or snapshots-and-staging requiring explicit -P activation — the profile properties aren't in scope, so expressions remain unresolved and the validator flags them as errors.

Regarding the Maven 3.x question: in Maven 3.x, there was no validation for uninterpolated expressions in repository URLs at all. The raw expressions were silently carried through. When a profile was activated, its properties got merged into the model during profile injection, and full model interpolation resolved them afterward. When a profile was NOT active, its repository definitions simply weren't included in the effective model, so the unresolved expressions were harmless. The interpolation always happened — just later in the pipeline, after profile activation.

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet merged commit cee3c33 into master May 14, 2026
24 checks passed
@gnodet gnodet deleted the ci-issue-11920 branch May 14, 2026 19:10
@github-actions
Copy link
Copy Markdown

@gnodet Please assign appropriate label to PR according to the type of change.

@hboutemy hboutemy added the bug Something isn't working label May 14, 2026
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.

Profile-scoped properties not interpolated in repository URL in Maven 4 (rc5)

3 participants