[#12301] Fix StackOverflowError with internal parent and CI-friendly revision#12314
Merged
Conversation
…revision Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
elharo
approved these changes
Jun 18, 2026
|
@gnodet Please assign appropriate label to PR according to the type of change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inDefaultModelBuilder:The cycle occurs because
getEnhancedProperties()reads the root model to resolve CI-friendly properties, which triggersdoReadFileModel()for the root POM, which callsgetEnhancedProperties()again.Fix
Added a shared
Set<Path> activeModelReadstoModelBuilderSessionStatethat tracks which POM files are currently being read in an outer call frame. WhengetEnhancedProperties()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:
derive())ConcurrentHashMap.newKeySet())finallyblock)Integration Test
Added
MavenITgh12301StackOverflowInternalParentRevisionTestwith a reproducer project that has:${revision}and.mvn/markerFixes #12301