diff --git a/README.md b/README.md index aef07e1..2654d44 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For applications built with [Spring Boot](https://spring.io/projects/spring-boot ## Getting Started -The client SDK requires Java 21 or later. Add it to your build, e.g. with Gradle: +The client SDK requires Java 21 or later. It is built against the Jackson version that the latest release of Spring Boot uses, and requires that version of Jackson or a later one. Add it to your build, e.g. with Gradle: ```kotlin dependencies { diff --git a/buildSrc/src/main/kotlin/eventsourcingdb.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/eventsourcingdb.java-conventions.gradle.kts index 50cb0ba..b2cf1a1 100644 --- a/buildSrc/src/main/kotlin/eventsourcingdb.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/eventsourcingdb.java-conventions.gradle.kts @@ -60,7 +60,26 @@ tasks.javadoc { (options as StandardJavadocDocletOptions).addBooleanOption("Werror", true) } +// Spring Boot decides which Jackson version Spring Boot applications use, so +// the modules build and test against the Jackson version of the Spring Boot +// release in the version catalog, instead of against one of their own. That +// way, the compiler can not pick anything a newer Jackson version adds. The +// release is pinned rather than looked up on every build, so that builds stay +// reproducible; Dependabot keeps it current. The versions of Spring Boot only +// apply where a module names no version, or a lower one, and they are not +// published. +val springBootVersions by configurations.creating { + isCanBeConsumed = false + isCanBeResolved = false +} + +listOf("compileClasspath", "runtimeClasspath", "testCompileClasspath", "testRuntimeClasspath").forEach { name -> + configurations.named(name) { extendsFrom(springBootVersions) } +} + dependencies { + springBootVersions(platform(libs.findLibrary("spring-boot-dependencies").get())) + api(libs.findLibrary("jspecify").get()) errorprone(libs.findLibrary("errorprone-core").get()) errorprone(libs.findLibrary("nullaway").get()) @@ -113,6 +132,18 @@ spotless { } } +// Publishes the versions the modules were built and tested against, e.g. the +// Jackson version that Spring Boot gives them. +publishing { + publications.withType().configureEach { + versionMapping { + allVariants { + fromResolutionResult() + } + } + } +} + mavenPublishing { publishToMavenCentral() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9894def..e9f6274 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,6 @@ assertj = "3.27.7" errorprone = "2.50.0" errorprone-gradle-plugin = "5.1.1" -jackson = "3.2.3" jspecify = "1.0.1" jacoco = "0.8.15" junit = "6.1.3" @@ -18,7 +17,7 @@ testcontainers = "2.0.5" assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } errorprone-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" } errorprone-gradle-plugin = { module = "net.ltgt.gradle:gradle-errorprone-plugin", version.ref = "errorprone-gradle-plugin" } -jackson-databind = { module = "tools.jackson.core:jackson-databind", version.ref = "jackson" } +jackson-databind = { module = "tools.jackson.core:jackson-databind" } jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" } jacoco-agent = { module = "org.jacoco:org.jacoco.agent", version.ref = "jacoco" } junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } @@ -27,6 +26,7 @@ maven-publish-gradle-plugin = { module = "com.vanniktech:gradle-maven-publish-pl palantir-java-format = { module = "com.palantir.javaformat:palantir-java-format", version.ref = "palantir-java-format" } slf4j-nop = { module = "org.slf4j:slf4j-nop", version.ref = "slf4j" } spotless-gradle-plugin = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } +spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" } spring-boot-configuration-processor = { module = "org.springframework.boot:spring-boot-configuration-processor", version.ref = "spring-boot" } spring-boot-jackson = { module = "org.springframework.boot:spring-boot-jackson", version.ref = "spring-boot" } spring-boot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "spring-boot" }