Apache Software Foundation / Maven Core
Merged upstreamReliabilitySelected contributionMerged Sep 15, 2026

Remove stack-depth limits from parent-model traversal

Replaced recursive parent-model assembly and parent-project initialization with explicit traversal frames, preserving inheritance and cache semantics.

apache/maven · #13104

Problem

A reported 1,000-project parent chain caused Maven and m2e to crash with StackOverflowError during project loading.

Approach

Uses iterative traversal while retaining inheritance order, profiles, cache replay, repositories, fallback, project identity, and classloader restoration. Tracks active sources and resolved coordinates to reject external mixin cycles, including opaque sources.

Impact and scope

  • Allows the reported deep parent hierarchy to load without consuming a Java stack frame per parent.
  • Preserves established model semantics and rejects cycles without preventing reuse of completed sources.
  • Separate recursion for module traversal and inferred parent coordinates remains outside this fix.

Validation

  • The PR reports the 1,000-parent reproducer failing before and passing afterward with a 1 MiB thread stack on JDK 21.
  • Focused checks and the full reactor/Core IT run passed: 1,074 integration tests with no failures or errors, 43 skipped.
  • GitHub build and integration matrices passed across Linux, macOS, Windows and JDK 17/21/25. Label automation failed separately; the verified merge commit credits Goutam Adwant.