From cc3d7d2d487cf18f7234898bd2e16703908a7b8b Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 21 Aug 2017 14:42:03 +0200 Subject: [PATCH] Apply dependency management to selected modules This commit applies the Dependency Management Plugin to modules that require it; right now Spring Framework is importing BOMs for Netty and Reactor dependencies only. Instead of applying those BOMs to all modules, they're applied only where they're needed. Issue: SPR-15885 --- build.gradle | 19 ------------------- spring-core/spring-core.gradle | 13 +++++++++++++ spring-messaging/spring-messaging.gradle | 13 +++++++++++++ spring-test/spring-test.gradle | 13 +++++++++++++ spring-web/spring-web.gradle | 12 ++++++++++++ spring-webflux/spring-webflux.gradle | 13 +++++++++++++ spring-webmvc/spring-webmvc.gradle | 12 ++++++++++++ spring-websocket/spring-websocket.gradle | 13 +++++++++++++ 8 files changed, 89 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index eae25ecd61..e323053cd5 100644 --- a/build.gradle +++ b/build.gradle @@ -90,13 +90,6 @@ configure(allprojects) { project -> configurations.all { // Check for updates every build resolutionStrategy.cacheChangingModulesFor 0, 'seconds' - - // Consistent netty version (e.g. clashes between netty-all vs netty-common) - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - if (details.requested.group == 'io.netty') { - details.useVersion nettyVersion - } - } } compileJava.options*.compilerArgs = [ @@ -185,18 +178,6 @@ configure(allprojects) { project -> configure(subprojects - project(":spring-build-src")) { subproject -> apply from: "${gradleScriptDir}/publish-maven.gradle" - apply plugin: "io.spring.dependency-management" - - dependencyManagement { - imports { - mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" - mavenBom "io.netty:netty-bom:${nettyVersion}" - } - resolutionStrategy { - cacheChangingModulesFor 0, 'seconds' - } - applyMavenExclusions = false - } configurations { jacoco diff --git a/spring-core/spring-core.gradle b/spring-core/spring-core.gradle index ed2e110732..1130552cde 100644 --- a/spring-core/spring-core.gradle +++ b/spring-core/spring-core.gradle @@ -1,5 +1,18 @@ description = "Spring Core" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + // As of Spring 4.0.3, spring-core includes asm 5.x and repackages cglib 3.2, inlining // both into the spring-core jar. cglib 3.2 itself depends on asm 5.x and is therefore // further transformed by the JarJar task to depend on org.springframework.asm; this diff --git a/spring-messaging/spring-messaging.gradle b/spring-messaging/spring-messaging.gradle index 7d611ee49e..ee0fcd3264 100644 --- a/spring-messaging/spring-messaging.gradle +++ b/spring-messaging/spring-messaging.gradle @@ -1,5 +1,18 @@ description = "Spring Messaging" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + dependencies { compile(project(":spring-beans")) compile(project(":spring-core")) diff --git a/spring-test/spring-test.gradle b/spring-test/spring-test.gradle index 29a341081d..84229450ae 100644 --- a/spring-test/spring-test.gradle +++ b/spring-test/spring-test.gradle @@ -1,5 +1,18 @@ description = "Spring TestContext Framework" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + dependencies { compile(project(":spring-core")) optional(project(":spring-aop")) diff --git a/spring-web/spring-web.gradle b/spring-web/spring-web.gradle index 7b42975de3..bd1e483623 100644 --- a/spring-web/spring-web.gradle +++ b/spring-web/spring-web.gradle @@ -1,6 +1,18 @@ description = "Spring Web" apply plugin: "groovy" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} dependencies { compile(project(":spring-beans")) diff --git a/spring-webflux/spring-webflux.gradle b/spring-webflux/spring-webflux.gradle index 8b579feb4b..3e68657891 100644 --- a/spring-webflux/spring-webflux.gradle +++ b/spring-webflux/spring-webflux.gradle @@ -1,5 +1,18 @@ description = "Spring WebFlux" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + dependencies { compile(project(":spring-beans")) compile(project(":spring-core")) diff --git a/spring-webmvc/spring-webmvc.gradle b/spring-webmvc/spring-webmvc.gradle index 589b8c371c..26bb7eaa3f 100644 --- a/spring-webmvc/spring-webmvc.gradle +++ b/spring-webmvc/spring-webmvc.gradle @@ -1,5 +1,17 @@ description = "Spring Web MVC" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + dependencies { provided("javax.servlet:javax.servlet-api:4.0.0") compile(project(":spring-aop")) diff --git a/spring-websocket/spring-websocket.gradle b/spring-websocket/spring-websocket.gradle index 5dd3bac77c..8ef10db749 100644 --- a/spring-websocket/spring-websocket.gradle +++ b/spring-websocket/spring-websocket.gradle @@ -1,5 +1,18 @@ description = "Spring WebSocket" +apply plugin: "io.spring.dependency-management" + +dependencyManagement { + imports { + mavenBom "io.projectreactor:reactor-bom:${reactorVersion}" + mavenBom "io.netty:netty-bom:${nettyVersion}" + } + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false +} + dependencies { compile(project(":spring-context")) compile(project(":spring-core"))