You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2025/11/04 09:52:43 UTC

[PR] Fix GH-11384: Resolve property before model reflection to avoid recursion [maven]

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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix GH-11384: Resolve property before model reflection to avoid recursion [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #11385:
URL: https://github.com/apache/maven/pull/11385#issuecomment-3490982794

   ## 💚 All backports created successfully
   
   | Status | Branch | Result |
   |:------:|:------:|:------|
   |✅|maven-4.0.x|[<img src="https://img.shields.io/github/pulls/detail/state/apache/maven/11390">](https://github.com/apache/maven/pull/11390)|
   
   ### Questions ?
   Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport)
   
   <!--- Backport version: 10.0.1 -->


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix GH-11384: Resolve property before model reflection to avoid recursion [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #11385:
URL: https://github.com/apache/maven/pull/11385


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org