Class BomResolutionUtil

java.lang.Object
netflix.nebula.dependency.recommender.util.BomResolutionUtil

public final class BomResolutionUtil extends Object
Utility class for handling BOM (Bill of Materials) resolution operations.

This utility provides methods for eagerly resolving BOM configurations during the configuration phase to prevent configuration resolution lock conflicts in parallel builds with Gradle 9+.

The eager resolution approach is particularly important for:

  • Parallel builds where configuration resolution locks can cause deadlocks
  • Build services that need cached BOM data during dependency resolution
  • External plugins that want to control when BOM resolution occurs
Since:
12.7.0
  • Method Details

    • eagerlyResolveBoms

      public static void eagerlyResolveBoms(org.gradle.api.Project project, RecommendationProviderContainer container, String bomConfigurationName)
      Eagerly resolves BOM configurations for the given project during the configuration phase.

      This method should be called during afterEvaluate when exclusive locks are available. It instructs the BomResolverService to resolve all BOM configurations and cache the results for later use during dependency resolution.

      The eager resolution prevents the need to resolve configurations during the dependency resolution phase, which would cause IllegalResolutionException in parallel builds with Gradle 9+.

      Usage by External Plugins:

      
       // Disable automatic eager resolution
       container.setEagerlyResolve(false);
       
       // Modify BOMs as needed
       container.mavenBom(module: 'com.example:updated-bom:1.0.0');
       
       // Manually trigger eager resolution
       BomResolutionUtil.eagerlyResolveBoms(project, container, "nebulaRecommenderBom");
       
      Parameters:
      project - the Gradle project whose BOM configurations should be resolved
      container - the recommendation provider container to check for additional BOM providers
      bomConfigurationName - the name of the BOM configuration to resolve
      Throws:
      IllegalArgumentException - if any parameter is null
      Since:
      12.7.0
    • shouldEagerlyResolveBoms

      public static boolean shouldEagerlyResolveBoms(org.gradle.api.Project project, RecommendationProviderContainer container)
      Checks if the given project should use eager BOM resolution.

      This method evaluates both the container's eager resolution setting and any project-specific overrides to determine if BOMs should be resolved eagerly.

      Parameters:
      project - the Gradle project to check
      container - the recommendation provider container with eager resolution settings
      Returns:
      true if BOMs should be resolved eagerly, false otherwise
      Throws:
      IllegalArgumentException - if any parameter is null
      Since:
      12.7.0