Skip to content

Commit 9585112

Browse files
committed
Move Gradle dependencyManagement configuration
The root project builds aggregated Javadoc. Therefore, it needs access to the `platform` dependencies * Move `dependencyManagement` configuration declaration into the `allprojects` section * Refactor `dependencyManagement` configuration declaration according to the idiomatic Groovy DSL for Gradle * Add `cacheChangingModulesFor 0` to avoid caching for SNAPSHOTs * Refactor `extendsFrom(dependencyManagement)` according to Groovy DSL for Gradle * Extends `javadocClasspath` configuration in the root project from the `dependencyManagement` to make Javadoc aggregation happy in regards to the required classpath
1 parent b097128 commit 9585112

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

build.gradle

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ allprojects {
107107
}
108108
// maven { url 'https://repo.spring.io/libs-staging-local' }
109109
}
110+
111+
configurations {
112+
dependencyManagement {
113+
canBeConsumed = false
114+
canBeResolved = false
115+
}
116+
117+
configureEach {
118+
resolutionStrategy.cacheChangingModulesFor 0, 'minutes'
119+
}
120+
}
121+
122+
dependencies {
123+
dependencyManagement(platform("com.fasterxml.jackson:jackson-bom:$jacksonBomVersion"))
124+
dependencyManagement(platform("tools.jackson:jackson-bom:$jackson3Version"))
125+
dependencyManagement(platform("org.junit:junit-bom:$junitJupiterVersion"))
126+
dependencyManagement(platform("org.springframework:spring-framework-bom:$springVersion"))
127+
dependencyManagement(platform("io.projectreactor:reactor-bom:$reactorVersion"))
128+
dependencyManagement(platform("org.apache.logging.log4j:log4j-bom:$log4jVersion"))
129+
dependencyManagement(platform("org.springframework.data:spring-data-bom:$springDataVersion"))
130+
dependencyManagement(platform("io.micrometer:micrometer-bom:$micrometerVersion"))
131+
dependencyManagement(platform("io.micrometer:micrometer-tracing-bom:$micrometerTracingVersion"))
132+
dependencyManagement(platform("org.testcontainers:testcontainers-bom:$testcontainersVersion"))
133+
}
110134
}
111135

112136
ext {
@@ -159,29 +183,14 @@ configure(javaProjects) { subproject ->
159183
}
160184
}
161185

162-
configurations.create("dependencyManagement") {
163-
canBeConsumed = false
164-
canBeResolved = false
165-
166-
configurations["compileClasspath"].extendsFrom(it)
167-
configurations["runtimeClasspath"].extendsFrom(it)
168-
configurations["testCompileClasspath"].extendsFrom(it)
169-
configurations["testRuntimeClasspath"].extendsFrom(it)
186+
configurations {
187+
[compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath].each {
188+
it.extendsFrom(dependencyManagement)
189+
}
170190
}
171191

172192
// dependencies that are common across all java projects
173193
dependencies {
174-
dependencyManagement(platform("com.fasterxml.jackson:jackson-bom:$jacksonBomVersion"))
175-
dependencyManagement(platform("tools.jackson:jackson-bom:$jackson3Version"))
176-
dependencyManagement(platform("org.junit:junit-bom:$junitJupiterVersion"))
177-
dependencyManagement(platform("org.springframework:spring-framework-bom:$springVersion"))
178-
dependencyManagement(platform("io.projectreactor:reactor-bom:$reactorVersion"))
179-
dependencyManagement(platform("org.apache.logging.log4j:log4j-bom:$log4jVersion"))
180-
dependencyManagement(platform("org.springframework.data:spring-data-bom:$springDataVersion"))
181-
dependencyManagement(platform("io.micrometer:micrometer-bom:$micrometerVersion"))
182-
dependencyManagement(platform("io.micrometer:micrometer-tracing-bom:$micrometerTracingVersion"))
183-
dependencyManagement(platform("org.testcontainers:testcontainers-bom:$testcontainersVersion"))
184-
185194
testImplementation 'org.apache.logging.log4j:log4j-core'
186195
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
187196
testImplementation("org.mockito:mockito-core:$mockitoVersion") {
@@ -526,6 +535,8 @@ dependencies {
526535
}
527536
}
528537

538+
configurations.javadocClasspath.extendsFrom(configurations.dependencyManagement)
539+
529540
javadoc {
530541
title = "${rootProject.description} ${version} API"
531542
options {

0 commit comments

Comments
 (0)