From 2f2e63c0b22677c1bec9283394595b4007b232a1 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Mon, 26 Apr 2021 11:28:33 +0200 Subject: [PATCH] The Kafka client now depends on Jackson, so we need to remove the "optional" dependency and make it mandatory. This commit also enables the Jackson features unconditionally as the capability will always be present. Our tests did not catch this issue as all of them had a dependency on quarkus-jackson. Fix #16769 (cherry picked from commit d85ae297960ae6c604829378207fa75b54007aab) --- extensions/kafka-client/deployment/pom.xml | 4 ++++ .../client/deployment/KafkaProcessor.java | 23 +++++++++++-------- extensions/kafka-client/runtime/pom.xml | 1 - integration-tests/kafka-avro/pom.xml | 17 -------------- integration-tests/kafka-sasl/pom.xml | 17 -------------- integration-tests/kafka-snappy/pom.xml | 17 -------------- integration-tests/kafka-ssl/pom.xml | 17 -------------- integration-tests/kafka/pom.xml | 17 -------------- 8 files changed, 17 insertions(+), 96 deletions(-) diff --git a/extensions/kafka-client/deployment/pom.xml b/extensions/kafka-client/deployment/pom.xml index b8230b918680f..91301064431a1 100644 --- a/extensions/kafka-client/deployment/pom.xml +++ b/extensions/kafka-client/deployment/pom.xml @@ -27,6 +27,10 @@ quarkus-junit5-internal test + + io.quarkus + quarkus-jackson-deployment + io.quarkus quarkus-arc-deployment diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index e2f3a62e73578..097c7e8aa037f 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -145,22 +145,25 @@ public void build( reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, i.getName())); collectSubclasses(toRegister, indexBuildItem, i); } + + // Kafka requires Jackson as it uses Jackson to handle authentication and some JSON utilities. + // See https://github.com/quarkusio/quarkus/issues/16769 + // So, enable the Jackson support unconditionally. + reflectiveClass.produce( + new ReflectiveClassBuildItem(false, false, ObjectMapperSerializer.class, + ObjectMapperDeserializer.class)); + collectSubclasses(toRegister, indexBuildItem, ObjectMapperSerializer.class); + collectSubclasses(toRegister, indexBuildItem, ObjectMapperDeserializer.class); + + // Make the `io.quarkus.jackson.runtime.ObjectMapperProducer` bean cannot be removed. + beans.produce(UnremovableBeanBuildItem.beanTypes(OBJECT_MAPPER)); + if (capabilities.isPresent(Capability.JSONB)) { reflectiveClass.produce( new ReflectiveClassBuildItem(false, false, JsonbSerializer.class, JsonbDeserializer.class)); collectSubclasses(toRegister, indexBuildItem, JsonbSerializer.class); collectSubclasses(toRegister, indexBuildItem, JsonbDeserializer.class); } - if (capabilities.isPresent(Capability.JACKSON)) { - reflectiveClass.produce( - new ReflectiveClassBuildItem(false, false, ObjectMapperSerializer.class, - ObjectMapperDeserializer.class)); - collectSubclasses(toRegister, indexBuildItem, ObjectMapperSerializer.class); - collectSubclasses(toRegister, indexBuildItem, ObjectMapperDeserializer.class); - - // Make the `io.quarkus.jackson.runtime.ObjectMapperProducer` bean cannot be removed. - beans.produce(UnremovableBeanBuildItem.beanTypes(OBJECT_MAPPER)); - } for (DotName s : toRegister) { reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, s.toString())); diff --git a/extensions/kafka-client/runtime/pom.xml b/extensions/kafka-client/runtime/pom.xml index 0aadb02763414..a32618d55b7a1 100644 --- a/extensions/kafka-client/runtime/pom.xml +++ b/extensions/kafka-client/runtime/pom.xml @@ -26,7 +26,6 @@ io.quarkus quarkus-jackson - true io.quarkus diff --git a/integration-tests/kafka-avro/pom.xml b/integration-tests/kafka-avro/pom.xml index ec5178a4294cf..cdaf10ab13869 100644 --- a/integration-tests/kafka-avro/pom.xml +++ b/integration-tests/kafka-avro/pom.xml @@ -32,10 +32,6 @@ io.quarkus quarkus-resteasy - - io.quarkus - quarkus-resteasy-jackson - io.quarkus quarkus-resteasy-jsonb @@ -205,19 +201,6 @@ - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-resteasy-jsonb-deployment diff --git a/integration-tests/kafka-sasl/pom.xml b/integration-tests/kafka-sasl/pom.xml index 29fa0a7af6af6..6d198595559ce 100644 --- a/integration-tests/kafka-sasl/pom.xml +++ b/integration-tests/kafka-sasl/pom.xml @@ -28,10 +28,6 @@ io.quarkus quarkus-resteasy - - io.quarkus - quarkus-resteasy-jackson - io.quarkus quarkus-resteasy-jsonb @@ -129,19 +125,6 @@ - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-resteasy-jsonb-deployment diff --git a/integration-tests/kafka-snappy/pom.xml b/integration-tests/kafka-snappy/pom.xml index 418cf0a01c994..e0b8d26f3d0d1 100644 --- a/integration-tests/kafka-snappy/pom.xml +++ b/integration-tests/kafka-snappy/pom.xml @@ -28,10 +28,6 @@ io.quarkus quarkus-resteasy - - io.quarkus - quarkus-resteasy-jackson - io.quarkus quarkus-resteasy-jsonb @@ -143,19 +139,6 @@ - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-resteasy-jsonb-deployment diff --git a/integration-tests/kafka-ssl/pom.xml b/integration-tests/kafka-ssl/pom.xml index 31f6125a25330..6889dbbacd19d 100644 --- a/integration-tests/kafka-ssl/pom.xml +++ b/integration-tests/kafka-ssl/pom.xml @@ -28,10 +28,6 @@ io.quarkus quarkus-resteasy - - io.quarkus - quarkus-resteasy-jackson - io.quarkus quarkus-resteasy-jsonb @@ -129,19 +125,6 @@ - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-resteasy-jsonb-deployment diff --git a/integration-tests/kafka/pom.xml b/integration-tests/kafka/pom.xml index e2a92e1e0a2c3..4d1c8c3f2dac2 100644 --- a/integration-tests/kafka/pom.xml +++ b/integration-tests/kafka/pom.xml @@ -28,10 +28,6 @@ io.quarkus quarkus-resteasy - - io.quarkus - quarkus-resteasy-jackson - io.quarkus quarkus-resteasy-jsonb @@ -129,19 +125,6 @@ - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-resteasy-jsonb-deployment