Class BomResolutionUtil
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 Summary
Modifier and TypeMethodDescriptionstatic voideagerlyResolveBoms(org.gradle.api.Project project, RecommendationProviderContainer container, String bomConfigurationName) Eagerly resolves BOM configurations for the given project during the configuration phase.static booleanshouldEagerlyResolveBoms(org.gradle.api.Project project, RecommendationProviderContainer container) Checks if the given project should use eager BOM resolution.
-
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
afterEvaluatewhen exclusive locks are available. It instructs theBomResolverServiceto 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
IllegalResolutionExceptionin 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 resolvedcontainer- the recommendation provider container to check for additional BOM providersbomConfigurationName- 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 checkcontainer- 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
-