Skip to content

Commit 5643538

Browse files
committed
fix: apply grails-bom platform to all declarable configurations
The Spring Dependency Management plugin applied version constraints globally to every configuration via configurations.all() and resolutionStrategy.eachDependency(). With the switch to Gradle's native platform(), version constraints must be added explicitly. Apply the grails-bom platform to all declarable configurations using configureEach, matching the previous global behavior. Non-declarable configurations (apiElements, runtimeElements, etc.) inherit constraints through their parent configurations. Also ensure the developmentOnly configuration always exists via maybeCreate, regardless of whether the Spring Boot plugin has been applied. Assisted-by: Claude Code <Claude@Claude.ai>
1 parent 531041b commit 5643538

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,21 @@ ${importStatements}
384384
String grailsVersion = (project.findProperty('grailsVersion') ?: BuildSettings.grailsVersion) as String
385385
String bomCoordinates = "org.apache.grails:grails-bom:${grailsVersion}" as String
386386

387-
project.dependencies.add('implementation', project.dependencies.platform(bomCoordinates))
387+
// Ensure the developmentOnly configuration exists. Spring Boot's plugin
388+
// normally creates this, but using maybeCreate guarantees it is available
389+
// even if plugin ordering changes or Spring Boot is not applied.
390+
project.configurations.maybeCreate('developmentOnly')
391+
392+
// Apply the BOM platform to all declarable configurations, matching the
393+
// behavior of the Spring Dependency Management plugin which applied version
394+
// constraints globally via configurations.all() + resolutionStrategy.eachDependency().
395+
// Non-declarable configurations (e.g. apiElements, runtimeElements) inherit
396+
// constraints through their parent configurations.
397+
project.configurations.configureEach { Configuration conf ->
398+
if (conf.canBeDeclared) {
399+
project.dependencies.add(conf.name, project.dependencies.platform(bomCoordinates))
400+
}
401+
}
388402

389403
project.afterEvaluate {
390404
BomManagedVersions managedVersions = BomManagedVersions.resolve(project, bomCoordinates)

0 commit comments

Comments
 (0)