gnodet opened a new pull request, #12314:
URL: https://github.com/apache/maven/pull/12314

   ## Problem
   
   When a multi-module project uses CI-friendly `${revision}` with an internal 
parent in a subdirectory and a `.mvn/` root marker, Maven 4 enters infinite 
recursion in `DefaultModelBuilder`:
   
   ```
   readFileModel → getEnhancedProperties → doReadFileModel → cache → 
readFileModel → …
   ```
   
   The cycle occurs because `getEnhancedProperties()` reads the root model to 
resolve CI-friendly properties, which triggers `doReadFileModel()` for the root 
POM, which calls `getEnhancedProperties()` again.
   
   ## Fix
   
   Added a shared `Set<Path> activeModelReads` to `ModelBuilderSessionState` 
that tracks which POM files are currently being read in an outer call frame. 
When `getEnhancedProperties()` detects that the root model is already being 
read (i.e., we're in a recursive call), it skips reading the root model to 
break the cycle.
   
   The set is:
   - Shared across all derived sessions (passed through `derive()`)
   - Thread-safe (`ConcurrentHashMap.newKeySet()`)
   - Self-cleaning (entries are removed in a `finally` block)
   
   ## Integration Test
   
   Added `MavenITgh12301StackOverflowInternalParentRevisionTest` with a 
reproducer project that has:
   - A root POM with `${revision}` and `.mvn/` marker
   - An internal parent module in a subdirectory
   
   Fixes #12301


-- 
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]

Reply via email to