jdaugherty commented on code in PR #15467:
URL: https://github.com/apache/grails-core/pull/15467#discussion_r3150902634


##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -354,35 +352,83 @@ ${importStatements}
     protected void applyDefaultPlugins(Project project) {
         applySpringBootPlugin(project)
 
-        project.afterEvaluate {
-            GrailsExtension ge = project.extensions.getByType(GrailsExtension)
-            if (ge.springDependencyManagement) {
-                Plugin dependencyManagementPlugin = 
project.plugins.findPlugin(DependencyManagementPlugin)
-                if (dependencyManagementPlugin == null) {
-                    project.plugins.apply(DependencyManagementPlugin)
-                }
+        applyGrailsBom(project)
+    }
 
-                DependencyManagementExtension dme = 
project.extensions.findByType(DependencyManagementExtension)
+    /**
+     * Applies the Grails BOM as a Gradle platform and configures 
property-based
+     * version overrides. This replaces the Spring Dependency Management 
plugin with
+     * a lightweight mechanism that:
+     * <ol>
+     *   <li>Imports {@code grails-bom} via Gradle's native {@code platform()} 
support</li>
+     *   <li>Parses the BOM POM chain to discover which Maven properties 
control which artifact versions</li>
+     *   <li>Checks project properties ({@code gradle.properties} or {@code 
ext['property.name']}) for overrides</li>
+     *   <li>Applies any overrides via {@code 
ResolutionStrategy.eachDependency()}</li>
+     * </ol>
+     *
+     * <p>Usage: to override a version managed by the Grails or Spring Boot 
BOM, set the
+     * corresponding property in {@code gradle.properties} or {@code 
build.gradle}:</p>
+     * <pre>
+     * // gradle.properties
+     * slf4j.version=1.7.36
+     *
+     * // or build.gradle
+     * ext['slf4j.version'] = '1.7.36'
+     * </pre>
+     *
+     * @see BomManagedVersions
+     * @since 8.0
+     */
+    protected void applyGrailsBom(Project project) {
+        String grailsVersion = (project.findProperty('grailsVersion') ?: 
BuildSettings.grailsVersion) as String

Review Comment:
   We need to extract the property features of this PR into it's own plugin 
separate from the bom so that it can be generically used / maintained.



##########
grails-doc/src/en/guide/commandLine/gradleBuild/gradleDependencies.adoc:
##########
@@ -60,28 +60,26 @@ dependencies {
 
 Note that version numbers are not present in the majority of the dependencies.
 
-This is thanks to the Spring dependency management plugin which automatically 
configures `grails-bom` as a Maven BOM via the Grails Gradle Plugin.  This 
defines the default dependency versions for most commonly used dependencies and 
plugins.
+This is thanks to Gradle's platform support which automatically imports 
`grails-bom` as a managed dependency platform via the Grails Gradle Plugin.  
This defines the default dependency versions for most commonly used 
dependencies and plugins.

Review Comment:
   The versions are only supported by your plugin.  Also, the dependency 
management plugin causes the bom versions to resolve to the spring version and 
not to the highest version.  We should discuss this side effect in the weekly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to