Class SCoverageAggregationCoordinator

java.lang.Object
org.scoverage.plugin.SCoverageAggregationCoordinator

public class SCoverageAggregationCoordinator extends Object
Coordinates aggregated coverage report generation in multi-threaded Maven builds.
Uses RepositorySystemSession.getData() which provides build-global, thread-safe storage that works across different plugin classloaders and all modules in the reactor.
Only stores standard Java types (ConcurrentHashMap, AtomicBoolean) loaded by the bootstrap classloader to avoid ClassCastException across different plugin classloaders.
Ensures that:
  • Only one thread (the last module) performs the aggregation
  • Other threads skip aggregation and continue

Implementation Note: Uses synchronized block with SessionData.get()/set() instead of computeIfAbsent() for backward compatibility with Maven 3.6.3+ (computeIfAbsent was added in Maven Resolver 1.9.x / Maven 3.9.x).
  • Constructor Details

    • SCoverageAggregationCoordinator

      public SCoverageAggregationCoordinator()
  • Method Details

    • shouldPerformAggregation

      public static boolean shouldPerformAggregation(org.eclipse.aether.RepositorySystemSession repositorySession, String moduleId, Set<String> expectedModuleIds)
      Notifies the coordinator that this module has completed testing and determines if it should perform aggregation. Only the last module to complete (in a parallel build) will return true, and only once.
      Parameters:
      repositorySession - Repository system session providing build-global storage
      moduleId - unique identifier for the module (e.g., groupId:artifactId)
      expectedModuleIds - set of expected module IDs (auto-registers build if needed)
      Returns:
      true if this module should perform aggregation, false otherwise