From 4b6016ccee00f3cd7a631ae01eba9b854d979b0f Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 2 Aug 2023 11:55:39 +0200 Subject: [PATCH] depend on json core not serde (#512) * use kotlin DSL * no need to import micronaut-logging catalogue * depend on json.core not serde * annotate with @Requires(JsonMapper.class) --- rabbitmq/build.gradle | 37 ----------------- rabbitmq/build.gradle.kts | 40 +++++++++++++++++++ .../serdes/JsonRabbitMessageSerDes.java | 2 + settings.gradle | 1 - 4 files changed, 42 insertions(+), 38 deletions(-) delete mode 100644 rabbitmq/build.gradle create mode 100644 rabbitmq/build.gradle.kts diff --git a/rabbitmq/build.gradle b/rabbitmq/build.gradle deleted file mode 100644 index 2dd4d3909..000000000 --- a/rabbitmq/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -plugins { - id 'io.micronaut.build.internal.rabbitmq-module' -} - -dependencies { - compileOnly libs.jsr305 - - api mn.micronaut.messaging - api mn.micronaut.inject - api libs.managed.amqp.client - - implementation mnSerde.micronaut.serde.support - implementation mnSerde.micronaut.serde.jackson - implementation mn.micronaut.retry - implementation mn.reactor - implementation libs.caffeine - - compileOnly mn.micronaut.management - compileOnly mnMicrometer.micronaut.micrometer.core - - testImplementation libs.testcontainers.spock - testImplementation mn.micronaut.inject.groovy - testImplementation mn.micronaut.inject.java - testImplementation mn.micronaut.management - testImplementation mnTest.micronaut.test.spock - testImplementation(mnMicrometer.micronaut.micrometer.core) { - exclude group: 'io.micronaut.reactor', module: 'micronaut-reactor' - } - testRuntimeOnly mnLogging.logback.classic -} - -test { - testLogging { - showStandardStreams = true - exceptionFormat = 'full' - } -} diff --git a/rabbitmq/build.gradle.kts b/rabbitmq/build.gradle.kts new file mode 100644 index 000000000..f3cb406f4 --- /dev/null +++ b/rabbitmq/build.gradle.kts @@ -0,0 +1,40 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + +plugins { + id("io.micronaut.build.internal.rabbitmq-module") +} + +dependencies { + compileOnly(libs.jsr305) + + api(mn.micronaut.messaging) + api(mn.micronaut.inject) + api(libs.managed.amqp.client) + + implementation(mn.micronaut.json.core) + + implementation(mn.micronaut.retry) + implementation(mn.reactor) + implementation(libs.caffeine) + + compileOnly(mn.micronaut.management) + compileOnly(mnMicrometer.micronaut.micrometer.core) + + testImplementation(mnSerde.micronaut.serde.jackson) + testImplementation(libs.testcontainers.spock) + testImplementation(mn.micronaut.inject.groovy) + testImplementation(mn.micronaut.inject.java) + testImplementation(mn.micronaut.management) + testImplementation(mnTest.micronaut.test.spock) + testImplementation(mnMicrometer.micronaut.micrometer.core) { + exclude("io.micronaut.reactor", "micronaut-reactor") + } + testRuntimeOnly(mnLogging.logback.classic) +} + +tasks { + named("test") { + testLogging.showStandardStreams = true + testLogging.exceptionFormat = TestExceptionFormat.FULL + } +} diff --git a/rabbitmq/src/main/java/io/micronaut/rabbitmq/serdes/JsonRabbitMessageSerDes.java b/rabbitmq/src/main/java/io/micronaut/rabbitmq/serdes/JsonRabbitMessageSerDes.java index 968e0fe8d..9ac39be38 100644 --- a/rabbitmq/src/main/java/io/micronaut/rabbitmq/serdes/JsonRabbitMessageSerDes.java +++ b/rabbitmq/src/main/java/io/micronaut/rabbitmq/serdes/JsonRabbitMessageSerDes.java @@ -15,6 +15,7 @@ */ package io.micronaut.rabbitmq.serdes; +import io.micronaut.context.annotation.Requires; import io.micronaut.core.reflect.ClassUtils; import io.micronaut.core.serialize.exceptions.SerializationException; import io.micronaut.core.type.Argument; @@ -32,6 +33,7 @@ * @author James Kleeh * @since 1.1.0 */ +@Requires(bean = JsonMapper.class) @Singleton public class JsonRabbitMessageSerDes implements RabbitMessageSerDes { diff --git a/settings.gradle b/settings.gradle index a8280406f..99a2cf981 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,7 +21,6 @@ include 'docs-examples:example-kotlin' enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS' micronautBuild { - importMicronautCatalog("micronaut-logging") useStandardizedProjectNames=true importMicronautCatalog() importMicronautCatalog("micronaut-micrometer")