From 254b8fe3cba3792f0bafc1a3b2fd7ee47d7cef71 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 11 Oct 2023 10:29:36 +0100 Subject: [PATCH] Closes gh-37815 --- buildSrc/build.gradle | 56 ++++++++++--------- gradle.properties | 6 ++ .../spring-boot-dependencies/build.gradle | 10 ++-- .../spring-boot-parent/build.gradle | 2 +- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 0f66ad0a6bc..92d9e0ee36d 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -9,51 +9,53 @@ repositories { gradlePluginPortal() } -new File(new File("$projectDir").parentFile, "gradle.properties").withInputStream { - def properties = new Properties() - properties.load(it) - ext.set("kotlinVersion", properties["kotlinVersion"]) - ext.set("springFrameworkVersion", properties["springFrameworkVersion"]) - if (properties["springFrameworkVersion"].contains("-")) { - repositories { - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/snapshot" } - } - } -} - sourceCompatibility = 1.8 targetCompatibility = 1.8 +def versions = [:] +new File(projectDir.parentFile, "gradle.properties").withInputStream { + def properties = new Properties() + properties.load(it) + ["assertj", "commonsCodec", "hamcrest", "jackson", "junitJupiter", + "kotlin", "maven", "springFramework"].each { + versions[it] = properties[it + "Version"] + } +} +ext.set("versions", versions) +if (versions.springFramework.contains("-")) { + repositories { + maven { url "https://repo.spring.io/milestone" } + maven { url "https://repo.spring.io/snapshot" } + } +} + dependencies { checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}" - implementation(platform("org.springframework:spring-framework-bom:${springFrameworkVersion}")) - implementation("com.fasterxml.jackson.core:jackson-databind:2.11.4") + implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}")) + implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") implementation("com.gradle:gradle-enterprise-gradle-plugin:3.12.1") implementation("com.tngtech.archunit:archunit:1.0.0") - implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0") - implementation("commons-codec:commons-codec:1.13") + implementation("commons-codec:commons-codec:${versions.commonsCodec}") implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}") - implementation("org.apache.maven:maven-embedder:3.6.2") + implementation("org.apache.maven:maven-embedder:${versions.maven}") implementation("org.asciidoctor:asciidoctor-gradle-jvm:3.3.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlinVersion}") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}") + implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${versions.kotlin}") implementation("org.springframework:spring-context") implementation("org.springframework:spring-core") implementation("org.springframework:spring-web") - testImplementation("org.apache.logging.log4j:log4j-core:2.17.1") - testImplementation("org.assertj:assertj-core:3.11.1") - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation("org.assertj:assertj-core:${versions.assertj}") + testImplementation("org.hamcrest:hamcrest:${versions.hamcrest}") + testImplementation("org.junit.jupiter:junit-jupiter:${versions.junitJupiter}") testImplementation("org.springframework:spring-test") testRuntimeOnly("org.junit.platform:junit-platform-launcher") } checkstyle { - toolVersion = 8.11 + toolVersion = 9.3 } gradlePlugin { @@ -63,8 +65,8 @@ gradlePlugin { implementationClass = "org.springframework.boot.build.processors.AnnotationProcessorPlugin" } architecturePlugin { - id = "org.springframework.boot.architecture" - implementationClass = "org.springframework.boot.build.architecture.ArchitecturePlugin" + id = "org.springframework.boot.architecture" + implementationClass = "org.springframework.boot.build.architecture.ArchitecturePlugin" } autoConfigurationPlugin { id = "org.springframework.boot.auto-configuration" diff --git a/gradle.properties b/gradle.properties index 096dddf11bc..47cf3a680a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,13 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 +assertjVersion=3.22.0 +commonsCodecVersion=1.15 +hamcrestVersion=2.2 +jacksonVersion=2.13.5 +junitJupiterVersion=5.8.2 kotlinVersion=1.6.21 +mavenVersion=3.9.4 springFrameworkVersion=5.3.30 tomcatVersion=9.0.80 diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index e5cbe83d71c..714d4c8663b 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -120,7 +120,7 @@ bom { ] } } - library("AssertJ", "3.22.0") { + library("AssertJ", "${assertjVersion}") { group("org.assertj") { modules = [ "assertj-core" @@ -210,7 +210,7 @@ bom { ] } } - library("Commons Codec", "1.15") { + library("Commons Codec", "${commonsCodecVersion}") { group("commons-codec") { modules = [ "commons-codec" @@ -443,7 +443,7 @@ bom { ] } } - library("Hamcrest", "2.2") { + library("Hamcrest", "${hamcrestVersion}") { group("org.hamcrest") { modules = [ "hamcrest", @@ -599,7 +599,7 @@ bom { ] } } - library("Jackson Bom", "2.13.5") { + library("Jackson Bom", "${jacksonVersion}") { group("com.fasterxml.jackson") { imports = [ "jackson-bom" @@ -1085,7 +1085,7 @@ bom { ] } } - library("JUnit Jupiter", "5.8.2") { + library("JUnit Jupiter", "${junitJupiterVersion}") { group("org.junit") { imports = [ "junit-bom" diff --git a/spring-boot-project/spring-boot-parent/build.gradle b/spring-boot-project/spring-boot-parent/build.gradle index 910604dd5c4..4dae0fc0996 100644 --- a/spring-boot-project/spring-boot-parent/build.gradle +++ b/spring-boot-project/spring-boot-parent/build.gradle @@ -80,7 +80,7 @@ bom { ] } } - library("Maven", "3.9.4") { + library("Maven", "${mavenVersion}") { group("org.apache.maven") { modules = [ "maven-plugin-api",