Skip to content

Comments

[maven-4.0.x] Resolve property before model reflection to avoid recursion (#11385, fixes #11384)#11390

Merged
gnodet merged 2 commits intoapache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/pr-11385
Nov 5, 2025
Merged

[maven-4.0.x] Resolve property before model reflection to avoid recursion (#11385, fixes #11384)#11390
gnodet merged 2 commits intoapache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/pr-11385

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Nov 5, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Questions ?

Please refer to the Backport tool documentation

…1385, fixes apache#11384)

When a POM contains ${project.url} in the <url> field and also defines
a property named 'project.url', Maven was incorrectly attempting to
resolve the expression via model reflection first, which would return
the same ${project.url} value, causing a recursive variable reference
error.

This fix changes the interpolation resolution order to check model
properties before prefixed model reflection. This allows properties
like 'project.url' to be resolved from the <properties> section before
attempting to use reflection on the model object.

The new resolution order is:
1. basedir
2. build.timestamp
3. user properties
4. model properties (moved up from position 5)
5. prefixed model reflection (moved down from position 3)
6. system properties
7. environment variables
8. unprefixed model reflection

This change is consistent with the approach used for MNG-8469, which
established that explicit property definitions should take precedence
over model field reflection.

Fixes apache#11384

(cherry picked from commit 727d80f)
@gnodet gnodet added this to the 4.0.0 milestone Nov 5, 2025
@gnodet gnodet merged commit 87fa189 into apache:maven-4.0.x Nov 5, 2025
41 of 42 checks passed
@gnodet gnodet deleted the backport/maven-4.0.x/pr-11385 branch November 5, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn40

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant