Skip to content

Make aggregation thread-safe (round 3: use RepositorySystemSession)#421

Merged
jozic merged 1 commit intoscoverage:mainfrom
jozic:fix-use-RepositorySystemSession
Feb 1, 2026
Merged

Make aggregation thread-safe (round 3: use RepositorySystemSession)#421
jozic merged 1 commit intoscoverage:mainfrom
jozic:fix-use-RepositorySystemSession

Conversation

@jozic
Copy link
Copy Markdown
Member

@jozic jozic commented Feb 1, 2026

Motivation

It happens that maven can load different modules using different classloaders and that MavenSession's data is also not guaranteed to be the same across all modules. The solution is to use RepositorySystemSession to sync across all modules.

For compatibility with Maven < 3.9, uses older get/set api

Checklist

  • Add/Update integration tests in src/it
  • Add/Update documentation in README

@jozic jozic force-pushed the fix-use-RepositorySystemSession branch from b026001 to 78d8dff Compare February 1, 2026 20:46
@jozic jozic marked this pull request as ready for review February 1, 2026 21:06
@jozic jozic requested a review from Copilot February 1, 2026 21:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses thread-safety issues in aggregated coverage report generation by switching from MavenSession to RepositorySystemSession for build-global storage. This ensures proper synchronization across modules that may be loaded with different classloaders.

Changes:

  • Replaced MavenSession with RepositorySystemSession for coordinating aggregation across modules
  • Updated storage implementation to use backward-compatible get/set API instead of computeIfAbsent for Maven 3.6.3+ compatibility
  • Added cleanup logic to remove data from session after aggregation is claimed

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/org/scoverage/plugin/SCoverageReportMojo.java Injected RepositorySystemSession parameter and updated aggregation coordinator call to use it
src/main/java/org/scoverage/plugin/SCoverageAggregationCoordinator.java Refactored to use RepositorySystemSession.getData() with backward-compatible synchronization approach
src/it/test_reactor_test_scoped_dependency/pom.xml Updated description to remove reference to specific scenario name

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jozic jozic merged commit fb305d5 into scoverage:main Feb 1, 2026
12 checks passed
@jozic jozic deleted the fix-use-RepositorySystemSession branch February 1, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants