Remove dependency management noise from POMs
Prior to this commit, the generated POMs for Spring Framework modules
would contain unneeded/harmful information from the Spring Framework
build:
1. The BOM imports applied to each module by the dependency
management plugin, for example for Netty or Reactor Netty.
Spring should not export that opinion to its POMs.
2. The exclusion of "org.slf4:jcl-over-slf4j" from *all* dependencies,
which made the POMs much larger than necessary and suggested to
developers that they should exclude it as well when using all those
listed dependencies. In fact, only Apache Tiles currently brings that
transitively.
This commit removes that information from the POMs.
The dependencyManagement Gradle plugin is disabled for POM generation
and we manually resolve the dependency versions during the generation
phase.
The Gradle build is streamlined to exclude "org.slf4:jcl-over-slf4j"
only when necessary.
Issue: SPR-16893
(Cherry-picked from 417354da8a)
This commit is contained in:
parent
062a15fbd7
commit
afcc430481
66
build.gradle
66
build.gradle
|
|
@ -35,40 +35,54 @@ ext {
|
|||
moduleProjects = subprojects.findAll {
|
||||
!it.name.equals('spring-build-src') && !it.name.equals('spring-framework-bom')
|
||||
}
|
||||
|
||||
aspectjVersion = "1.8.13"
|
||||
freemarkerVersion = "2.3.27-incubating"
|
||||
groovyVersion = "2.4.15"
|
||||
hsqldbVersion = "2.4.1"
|
||||
jackson2Version = "2.9.5"
|
||||
jettyVersion = "9.4.11.v20180605"
|
||||
junitJupiterVersion = "5.0.3"
|
||||
junitPlatformVersion = "1.0.3"
|
||||
junitVintageVersion = "4.12.3"
|
||||
kotlinVersion = "1.2.41"
|
||||
log4jVersion = "2.11.0"
|
||||
nettyVersion = "4.1.25.Final"
|
||||
reactorVersion = "Bismuth-SR9"
|
||||
rxjavaVersion = "1.3.8"
|
||||
rxjavaAdapterVersion = "1.2.1"
|
||||
rxjava2Version = "2.1.14"
|
||||
slf4jVersion = "1.7.25" // spring-jcl + consistent 3rd party deps
|
||||
tiles3Version = "3.0.8"
|
||||
tomcatVersion = "8.5.31"
|
||||
undertowVersion = "1.4.25.Final"
|
||||
|
||||
gradleScriptDir = "${rootProject.projectDir}/gradle"
|
||||
withoutJclOverSlf4J = {
|
||||
exclude group: "org.slf4j", module: "jcl-over-slf4j"
|
||||
}
|
||||
}
|
||||
|
||||
configure(allprojects) { project ->
|
||||
group = "org.springframework"
|
||||
version = qualifyVersionIfNecessary(version)
|
||||
|
||||
ext.aspectjVersion = "1.8.13"
|
||||
ext.freemarkerVersion = "2.3.27-incubating"
|
||||
ext.groovyVersion = "2.4.15"
|
||||
ext.hsqldbVersion = "2.4.1"
|
||||
ext.jackson2Version = "2.9.5"
|
||||
ext.jettyVersion = "9.4.11.v20180605"
|
||||
ext.junitJupiterVersion = "5.0.3"
|
||||
ext.junitPlatformVersion = "1.0.3"
|
||||
ext.junitVintageVersion = "4.12.3"
|
||||
ext.kotlinVersion = "1.2.41"
|
||||
ext.log4jVersion = "2.11.0"
|
||||
ext.nettyVersion = "4.1.25.Final"
|
||||
ext.reactorVersion = "Bismuth-SR9"
|
||||
ext.rxjavaVersion = "1.3.8"
|
||||
ext.rxjavaAdapterVersion = "1.2.1"
|
||||
ext.rxjava2Version = "2.1.14"
|
||||
ext.slf4jVersion = "1.7.25" // spring-jcl + consistent 3rd party deps
|
||||
ext.tiles3Version = "3.0.8"
|
||||
ext.tomcatVersion = "8.5.31"
|
||||
ext.undertowVersion = "1.4.25.Final"
|
||||
|
||||
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
|
||||
|
||||
apply plugin: "propdeps"
|
||||
apply plugin: "java"
|
||||
apply plugin: "test-source-set-dependencies"
|
||||
apply plugin: "io.spring.dependency-management"
|
||||
apply from: "${gradleScriptDir}/ide.gradle"
|
||||
|
||||
dependencyManagement {
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor 0, 'seconds'
|
||||
}
|
||||
applyMavenExclusions = false
|
||||
generatedPomCustomization {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin"
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
|
|
@ -96,7 +110,6 @@ configure(allprojects) { project ->
|
|||
}
|
||||
}
|
||||
|
||||
exclude group: "org.slf4j", module: "jcl-over-slf4j"
|
||||
}
|
||||
|
||||
def commonCompilerArgs =
|
||||
|
|
@ -238,7 +251,6 @@ configure(rootProject) {
|
|||
description = "Spring Framework"
|
||||
|
||||
apply plugin: "groovy"
|
||||
apply plugin: "io.spring.dependency-management"
|
||||
apply from: "${gradleScriptDir}/jdiff.gradle"
|
||||
apply from: "${gradleScriptDir}/docs.gradle"
|
||||
|
||||
|
|
@ -246,10 +258,6 @@ configure(rootProject) {
|
|||
imports {
|
||||
mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
|
||||
}
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor 0, 'seconds'
|
||||
}
|
||||
applyMavenExclusions = false
|
||||
}
|
||||
|
||||
// don't publish the default jar for the root project
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ def customizePom(pom, gradleProject) {
|
|||
"$dep.scope:$dep.groupId:$dep.artifactId"
|
||||
}
|
||||
|
||||
def managedVersions = dependencyManagement.managedVersions
|
||||
generatedPom.dependencies.findAll{dep -> !dep.version }.each { dep ->
|
||||
dep.version = managedVersions["${dep.groupId}:${dep.artifactId}"]
|
||||
}
|
||||
|
||||
// add all items necessary for maven central publication
|
||||
generatedPom.project {
|
||||
name = gradleProject.description
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
description = "Spring Framework (Bill of Materials)"
|
||||
|
||||
dependencyManagement {
|
||||
generatedPomCustomization {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
configurations.archives.artifacts.clear()
|
||||
artifacts {
|
||||
// work around GRADLE-2406 by attaching text artifact
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
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 {
|
||||
|
|
@ -74,8 +68,8 @@ dependencies {
|
|||
testCompile("com.thoughtworks.xstream:xstream:1.4.10")
|
||||
testCompile("com.rometools:rome:1.9.0")
|
||||
testCompile("org.apache.tiles:tiles-api:${tiles3Version}")
|
||||
testCompile("org.apache.tiles:tiles-core:${tiles3Version}")
|
||||
testCompile("org.apache.tiles:tiles-servlet:${tiles3Version}")
|
||||
testCompile("org.apache.tiles:tiles-core:${tiles3Version}", withoutJclOverSlf4J)
|
||||
testCompile("org.apache.tiles:tiles-servlet:${tiles3Version}", withoutJclOverSlf4J)
|
||||
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
|
||||
testCompile("org.apache.httpcomponents:httpclient:4.5.5") {
|
||||
exclude group: "commons-logging", module: "commons-logging"
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
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 {
|
||||
|
|
@ -35,13 +29,14 @@ dependencies {
|
|||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jackson2Version}")
|
||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${jackson2Version}")
|
||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${jackson2Version}")
|
||||
optional("org.apache.tiles:tiles-api:${tiles3Version}")
|
||||
optional("org.apache.tiles:tiles-core:${tiles3Version}")
|
||||
optional("org.apache.tiles:tiles-servlet:${tiles3Version}")
|
||||
optional("org.apache.tiles:tiles-jsp:${tiles3Version}")
|
||||
optional("org.apache.tiles:tiles-el:${tiles3Version}")
|
||||
optional("org.apache.tiles:tiles-api:${tiles3Version}", withoutJclOverSlf4J)
|
||||
optional("org.apache.tiles:tiles-core:${tiles3Version}", withoutJclOverSlf4J)
|
||||
optional("org.apache.tiles:tiles-servlet:${tiles3Version}", withoutJclOverSlf4J)
|
||||
optional("org.apache.tiles:tiles-jsp:${tiles3Version}", withoutJclOverSlf4J)
|
||||
optional("org.apache.tiles:tiles-el:${tiles3Version}", withoutJclOverSlf4J)
|
||||
optional("org.apache.tiles:tiles-extras:${tiles3Version}") {
|
||||
exclude group: "org.springframework", module: "spring-web"
|
||||
exclude group: "org.slf4j", module: "jcl-over-slf4j"
|
||||
}
|
||||
optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
|
||||
optional("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue