Skip to content

GH-10058: Introduce Jackson 3 in the Gradle build #10158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ext {
hsqldbVersion = '2.7.4'
h2Version = '2.3.232'
jacksonVersion = '2.19.1'
jackson3Version = '3.0.0-rc5'
jaxbVersion = '4.0.5'
jcifsVersion = '2.1.40'
jeroMqVersion = '0.6.0'
Expand Down Expand Up @@ -165,6 +166,7 @@ allprojects {

imports {
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion"
mavenBom "tools.jackson:jackson-bom:$jackson3Version"
mavenBom "io.micrometer:micrometer-bom:$micrometerVersion"
mavenBom "io.micrometer:micrometer-tracing-bom:$micrometerTracingVersion"
mavenBom "io.projectreactor:reactor-bom:$reactorVersion"
Expand Down Expand Up @@ -453,6 +455,7 @@ project('spring-integration-amqp') {
testImplementation 'org.springframework:spring-web'
testImplementation 'org.testcontainers:rabbitmq'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
}
}

Expand Down Expand Up @@ -497,6 +500,11 @@ project('spring-integration-core') {
api 'io.projectreactor:reactor-core'
api 'io.micrometer:micrometer-observation'

optionalApi 'tools.jackson.core:jackson-databind'
optionalApi 'tools.jackson.datatype:jackson-datatype-joda'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not familiar with Jackson 3 and how it manages time API, but is Joda still a thing?
From where did you take this dependencies arrangement ?
Why there are no more for time, for example and parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Jackson 3, "parameter names" and "datatypes" modules are now built-in.
JSTEP documentation: https://github.com/FasterXML/jackson-future-ideas/wiki/Jackson3-Changes#maven-modules-jars-java-packages

For Joda, I added it by referencing our Jackson2JsonObjectMapper. I tested it as shown below, and without adding JodaModule, Joda couldn't be supported.

public static class JodaData {
    public String name;
    public org.joda.time.DateTime createdAt;

    public JodaData(String name, DateTime createdAt) {
       this.name = name;
       this.createdAt = createdAt;
    }
}

@Test
@DisplayName("[Jackson3] With JodaModule")
public void testJackson3JodaSerializationWithJodaModule() throws Exception {
    tools.jackson.databind.ObjectMapper mapper = JsonMapper.builder()
          .addModule(new JodaModule())
          .build();

    DateTime jodaDateTime = new DateTime();
    JodaData data = new JodaData("John", jodaDateTime);

    String json = mapper.writeValueAsString(data);
    mapper.readValue(json, JodaData.class);
    System.out.println("✅ Joda works with JodaModule in Jackson 3");
}

@Test
@DisplayName("[Jackson3] Without JodaModule")
public void testJackson3JodaSerializationWithoutJodaModule() throws Exception {
    tools.jackson.databind.ObjectMapper mapper = JsonMapper.builder()
          .build();

    DateTime jodaDateTime = new DateTime();
    JodaData data = new JodaData("John", jodaDateTime);

    Assert.assertThrows(tools.jackson.core.JacksonException.class, () -> mapper.writeValueAsString(data));
    System.out.println("❌ Joda doesn't work without JodaModule");
}

There are many changes in default configurations and other aspects. To save our time, I'll leave review comments with references to these changes in upcoming PRs!

optionalApi('tools.jackson.module:jackson-module-kotlin') {
exclude group: 'org.jetbrains.kotlin'
}
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
Expand Down Expand Up @@ -592,6 +600,7 @@ project('spring-integration-file') {
testImplementation "io.lettuce:lettuce-core:$lettuceVersion"
testImplementation "com.jayway.jsonpath:json-path:$jsonpathVersion"
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
}
}

Expand Down Expand Up @@ -668,6 +677,7 @@ project('spring-integration-http') {
testImplementation 'org.springframework.security:spring-security-config'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'

testRuntimeOnly "com.jayway.jsonpath:json-path:$jsonpathVersion"
}
Expand All @@ -681,6 +691,7 @@ project('spring-integration-ip') {

testRuntimeOnly "com.esotericsoftware:kryo:$kryoVersion"
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
testRuntimeOnly 'tools.jackson.core:jackson-databind'
}

tasks.withType(JavaForkOptions) {
Expand Down Expand Up @@ -709,6 +720,7 @@ project('spring-integration-jdbc') {
testImplementation 'org.testcontainers:oracle-xe'

testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
testRuntimeOnly 'tools.jackson.core:jackson-databind'
testRuntimeOnly "com.oracle.database.jdbc:ojdbc11:$oracleVersion"
}
}
Expand All @@ -725,6 +737,7 @@ project('spring-integration-jms') {
testImplementation "org.apache.activemq:artemis-jakarta-client:$artemisVersion"
testImplementation 'org.springframework:spring-oxm'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
testImplementation 'io.micrometer:micrometer-observation-test'
}
}
Expand Down Expand Up @@ -757,6 +770,7 @@ project('spring-integration-kafka') {
exclude group: 'ch.qos.logback'
}
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
}
}

Expand Down Expand Up @@ -802,6 +816,7 @@ project('spring-integration-mqtt') {

testImplementation project(':spring-integration-jmx')
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
}
}

Expand All @@ -812,6 +827,7 @@ project('spring-integration-redis') {

testImplementation "io.lettuce:lettuce-core:$lettuceVersion"
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
}
}

Expand Down Expand Up @@ -882,6 +898,7 @@ project('spring-integration-stomp') {
}
testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion"
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'

testRuntimeOnly 'org.springframework:spring-webmvc'
testRuntimeOnly 'io.projectreactor.netty:reactor-netty-http'
Expand Down Expand Up @@ -931,6 +948,7 @@ project('spring-integration-webflux') {
testImplementation 'org.springframework.security:spring-security-config'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'tools.jackson.core:jackson-databind'
testImplementation 'io.micrometer:micrometer-observation-test'
testImplementation('io.micrometer:micrometer-tracing-integration-test') {
exclude group: 'io.opentelemetry'
Expand All @@ -953,6 +971,7 @@ project('spring-integration-websocket') {
testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion"

testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
testRuntimeOnly 'tools.jackson.core:jackson-databind'
}

tasks.withType(JavaForkOptions) {
Expand Down Expand Up @@ -1024,6 +1043,7 @@ project('spring-integration-zeromq') {
api "org.zeromq:jeromq:$jeroMqVersion"

optionalApi 'com.fasterxml.jackson.core:jackson-databind'
optionalApi 'tools.jackson.core:jackson-databind'
}
}

Expand Down