gnodet opened a new pull request, #11385:
URL: https://github.com/apache/maven/pull/11385
## Description
Fixes #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 pattern is used by projects like
[slack-sdk-parent](https://github.com/slackapi/java-slack-sdk/blob/main/slack-sdk-parent/pom.xml).
## Solution
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.
### New Resolution Order
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
## Rationale
This change is consistent with the approach used for MNG-8469, which
established that explicit property definitions should take precedence over
model field reflection.
## Testing
- Added unit test:
`DefaultModelInterpolatorTest.testProjectUrlPropertyDoesNotCauseRecursion()`
- Added integration test: `MavenITgh11384RecursiveVariableReferenceTest`
- All existing tests pass (448 tests in maven-impl module)
---
Pull Request opened by [Augment Code](https://www.augmentcode.com/) with
guidance from the PR author
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]