Skip to content

Fix: make ProjectIndex thread-safe for parallel builds (backport #12832) - #12928

Merged
gnodet merged 1 commit into
maven-3.9.xfrom
backport/12832-3.9.x
Aug 30, 2026
Merged

Fix: make ProjectIndex thread-safe for parallel builds (backport #12832)#12928
gnodet merged 1 commit into
maven-3.9.xfrom
backport/12832-3.9.x

Conversation

@gnodet

@gnodet gnodet commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of #12832 to maven-3.9.x.

  • Switch ProjectIndex backing maps from HashMap to ConcurrentHashMap to fix root cause of index corruption under parallel builds (-T)
  • Add null guards for both indices and projects lookups with enriched error messages mentioning parallel builds and extensions as possible causes

Test plan

  • CI green

🤖 Generated with Claude Code

Backport of #12832 to maven-3.9.x. Switch ProjectIndex backing maps from
HashMap to ConcurrentHashMap to fix root cause of index corruption under
parallel builds (-T). Add null guards for both index and project lookups
with enriched error messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean backport of #12832 to maven-3.9.x. The adaptation is correct — on master the MojoExecutor already had a basic null check that #12832 enhanced, whereas on maven-3.9.x there was no null check at all (raw auto-unboxing), so the backport correctly introduces the full null guard pattern.

Observations (informational):

  • The ConcurrentHashMap switch in ProjectIndex is identical to the master change and is particularly important on 3.9.x where projectIndex is passed as a method parameter and shared across threads
  • The path difference (maven-core/ vs impl/maven-core/ on master) reflects the expected directory reorganization between branches
  • All three maintenance branches are covered: #12926 (maven-4.0.x), #12927 (maven-3.10.x), #12928 (maven-3.9.x)

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@gnodet
gnodet merged commit 221f868 into maven-3.9.x Aug 30, 2026
22 checks passed
@gnodet
gnodet deleted the backport/12832-3.9.x branch August 30, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant