From 6d58315fb3bbf8727511a01357e2b697f0d4d4e5 Mon Sep 17 00:00:00 2001 From: Jaiden Ashmore Date: Sun, 2 Aug 2020 20:39:51 +1000 Subject: [PATCH] refs #270: move versioning to gradle properties instead of constraints --- api/build.gradle.kts | 3 + build.gradle.kts | 75 ++++++------------- core/build.gradle.kts | 7 +- .../aws-xray-spring-example/build.gradle.kts | 10 ++- examples/core-example/build.gradle.kts | 18 ++--- examples/core-kotlin-example/build.gradle.kts | 14 ++-- examples/ktor-example/build.gradle.kts | 9 ++- examples/spring-aws-example/build.gradle.kts | 5 +- .../build.gradle.kts | 3 + .../build.gradle.kts | 7 +- .../build.gradle.kts | 7 +- .../build.gradle.kts | 4 +- .../build.gradle.kts | 6 +- .../jashmore/sqs/examples/Application.java | 48 +----------- .../spring-sleuth-example/build.gradle.kts | 6 +- .../spring-starter-example/build.gradle.kts | 6 +- .../build.gradle.kts | 3 + .../build.gradle.kts | 15 +++- .../aws-xray-extension/core/build.gradle.kts | 4 +- .../spring-boot/build.gradle.kts | 4 + .../brave-extension/core/build.gradle.kts | 6 +- .../spring-boot/build.gradle.kts | 7 +- extensions/core-kotlin-dsl/build.gradle.kts | 7 +- .../build.gradle.kts | 6 +- .../build.gradle.kts | 4 +- .../build.gradle.kts | 5 +- gradle.properties | 24 ++++++ ktor/core/build.gradle.kts | 9 ++- settings.gradle.kts | 3 + spring/spring-core/build.gradle.kts | 4 + spring/spring-starter/build.gradle.kts | 5 +- .../build.gradle.kts | 9 ++- util/common-utils/build.gradle.kts | 4 +- util/elasticmq-sqs-client/build.gradle.kts | 5 +- util/local-sqs-async-client/build.gradle.kts | 11 ++- .../proxy-method-interceptor/build.gradle.kts | 4 +- util/sqs-brave-tracing/build.gradle.kts | 8 +- 37 files changed, 216 insertions(+), 159 deletions(-) create mode 100644 gradle.properties diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 4e4e3d42..e88656bb 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,6 +1,9 @@ description = "This contains the api functionality for the SQS Listener. This can be used for consumer to implement themselves" +val awsVersion: String by project + dependencies { + api(platform("software.amazon.awssdk:bom:${awsVersion}")) api("software.amazon.awssdk:sqs") compileOnly(project(":documentation-annotations")) } diff --git a/build.gradle.kts b/build.gradle.kts index 57c382af..a85bf202 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,12 +8,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { java `java-library` - id("com.github.spotbugs") version "4.4.5" checkstyle jacoco - kotlin("jvm") version "1.3.72" apply false + id("com.github.spotbugs") + kotlin("jvm") apply false id("org.jlleitschuh.gradle.ktlint") apply false - id("io.gitlab.arturbosch.detekt") version "1.10.0" apply false + id("io.gitlab.arturbosch.detekt") apply false } allprojects { @@ -27,6 +27,13 @@ allprojects { } } +val assertJVersion: String by project +val junitJupiterVersion: String by project +val logbackVersion: String by project +val lombokVersion: String by project +val mockitoVersion: String by project +val spotbugsVersion: String by project + subprojects { val isKotlinProject = project.name.contains("kotlin") || project.name.contains("ktor") apply(plugin = "java-library") @@ -45,65 +52,25 @@ subprojects { } dependencies { - // AWS - implementation(platform("software.amazon.awssdk:bom:2.13.66")) - api(platform("software.amazon.awssdk:bom:2.13.58")) - - // Spring Boot - api(platform("org.springframework.boot:spring-boot-dependencies:2.3.2.RELEASE")) - // Lombok - compileOnly("org.projectlombok:lombok:1.18.12") - annotationProcessor("org.projectlombok:lombok:1.18.12") - testCompileOnly("org.projectlombok:lombok:1.18.12") - testAnnotationProcessor("org.projectlombok:lombok:1.18.12") + compileOnly("org.projectlombok:lombok:$lombokVersion") + annotationProcessor("org.projectlombok:lombok:$lombokVersion") + testCompileOnly("org.projectlombok:lombok:$lombokVersion") + testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion") // Testing (JUnit, Mockito, etc) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.2") - testImplementation("org.mockito:mockito-junit-jupiter:3.4.6") - testImplementation("org.mockito:mockito-core:3.4.6") - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.assertj:assertj-core:3.16.1") + testImplementation("org.assertj:assertj-core:$assertJVersion") + testImplementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion") + testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion") + testImplementation("org.mockito:mockito-core:$mockitoVersion") // Logging for tests - testImplementation("ch.qos.logback:logback-core") - testImplementation("ch.qos.logback:logback-classic") + testImplementation("ch.qos.logback:logback-core:$logbackVersion") + testImplementation("ch.qos.logback:logback-classic:$logbackVersion") if (!isKotlinProject) { // SpotBugs - spotbugs("com.github.spotbugs:spotbugs:4.1.1") - } - - constraints { - // Jackson - implementation("com.fasterxml.jackson.core:jackson-databind:2.11.1") - - // Avro/Spring Cloud Schema Registry - implementation("org.apache.avro:avro:1.10.0") - implementation("org.springframework.cloud:spring-cloud-schema-registry-client:1.0.7.RELEASE") - - // Proxying - implementation("cglib:cglib:3.3.0") - - // Slf4j - implementation("org.slf4j:slf4j-api:1.7.30") - - // Brave - implementation("io.zipkin.brave:brave:5.12.4") - implementation("io.zipkin.brave:brave-context-slf4j:5.12.4") - implementation("io.zipkin.brave:brave-tests:5.12.4") - - // ElasticMQ - implementation("org.elasticmq:elasticmq-rest-sqs_2.12:0.15.6") - - // AWS Xray - implementation("com.amazonaws:aws-xray-recorder-sdk-core:2.6.1") - implementation("com.amazonaws:aws-xray-recorder-sdk-spring:2.6.1") - implementation("com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2-instrumentor:2.6.1") - - // Logback (for tests) - implementation("ch.qos.logback:logback-core:1.2.3") - implementation("ch.qos.logback:logback-classic:1.2.3") + spotbugs("com.github.spotbugs:spotbugs:$spotbugsVersion") } } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 61e6f4fe..a9341c3c 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,13 +1,16 @@ description = "Contains the core functionality for the library" +val jacksonVersion: String by project +val slf4jVersion: String by project + dependencies { api(project(":java-dynamic-sqs-listener-api")) implementation(project(":annotation-utils")) compileOnly(project(":documentation-annotations")) implementation(project(":common-utils")) - implementation("org.slf4j:slf4j-api") - api("com.fasterxml.jackson.core:jackson-databind") + implementation("org.slf4j:slf4j-api:$slf4jVersion") + api("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":proxy-method-interceptor")) diff --git a/examples/aws-xray-spring-example/build.gradle.kts b/examples/aws-xray-spring-example/build.gradle.kts index b22f5b11..3423fb2f 100644 --- a/examples/aws-xray-spring-example/build.gradle.kts +++ b/examples/aws-xray-spring-example/build.gradle.kts @@ -5,10 +5,16 @@ plugins { id("org.springframework.boot") } +val awsVersion: String by project +val awsXrayVersion: String by project +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) + api(platform("software.amazon.awssdk:bom:$awsVersion")) implementation("software.amazon.awssdk:sns") - implementation("com.amazonaws:aws-xray-recorder-sdk-core") - implementation("com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2-instrumentor") + implementation("com.amazonaws:aws-xray-recorder-sdk-core:$awsXrayVersion") + implementation("com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2-instrumentor:$awsXrayVersion") implementation("org.springframework.boot:spring-boot-starter") implementation(project(":aws-xray-extension-spring-boot")) implementation(project(":java-dynamic-sqs-listener-spring-starter")) diff --git a/examples/core-example/build.gradle.kts b/examples/core-example/build.gradle.kts index b1c0d2e4..be35a3fe 100644 --- a/examples/core-example/build.gradle.kts +++ b/examples/core-example/build.gradle.kts @@ -1,20 +1,20 @@ -plugins { - java -} - description = "Contains examples for using the core implementation of the listener with plan Java objects." +val braveVersion: String by project +val guavaVersion: String by project +val logbackVersion: String by project + dependencies { - implementation("com.google.guava:guava:29.0-jre") + implementation("com.google.guava:guava:$guavaVersion") implementation(project(":java-dynamic-sqs-listener-core")) implementation(project(":elasticmq-sqs-client")) - implementation("io.zipkin.brave:brave") - implementation("io.zipkin.brave:brave-context-slf4j") + implementation("io.zipkin.brave:brave:$braveVersion") + implementation("io.zipkin.brave:brave-context-slf4j:$braveVersion") implementation(project(":brave-extension-core")) compileOnly(project(":documentation-annotations")) - implementation("ch.qos.logback:logback-core") - implementation("ch.qos.logback:logback-classic") + implementation("ch.qos.logback:logback-core:$logbackVersion") + implementation("ch.qos.logback:logback-classic:$logbackVersion") } tasks.create("runApp") { diff --git a/examples/core-kotlin-example/build.gradle.kts b/examples/core-kotlin-example/build.gradle.kts index 732bd30e..3c05c6d0 100644 --- a/examples/core-kotlin-example/build.gradle.kts +++ b/examples/core-kotlin-example/build.gradle.kts @@ -1,17 +1,21 @@ description = "Example of using the Core library with the Kotlin DSL, this should be equivalent to the core-examples." +val braveVersion: String by project +val jacksonVersion: String by project +val logbackVersion: String by project + dependencies { implementation(kotlin("stdlib-jdk8")) implementation(project(":java-dynamic-sqs-listener-core")) implementation(project(":elasticmq-sqs-client")) implementation(project(":core-kotlin-dsl")) - implementation("io.zipkin.brave:brave") - implementation("io.zipkin.brave:brave-context-slf4j") + implementation("io.zipkin.brave:brave:$braveVersion") + implementation("io.zipkin.brave:brave-context-slf4j:$braveVersion") implementation(project(":brave-extension-core")) - implementation("ch.qos.logback:logback-core") - implementation("ch.qos.logback:logback-classic") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") + implementation("ch.qos.logback:logback-core:$logbackVersion") + implementation("ch.qos.logback:logback-classic:$logbackVersion") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") } tasks.create("runApp") { diff --git a/examples/ktor-example/build.gradle.kts b/examples/ktor-example/build.gradle.kts index 5bc6ea77..b8ed9e02 100644 --- a/examples/ktor-example/build.gradle.kts +++ b/examples/ktor-example/build.gradle.kts @@ -1,14 +1,17 @@ description = "Contains examples for connection to SQS in an Ktor Application" +val logbackVersion: String by project +val ktorVersion: String by project + dependencies { implementation(project(":java-dynamic-sqs-listener-core")) implementation(project(":core-kotlin-dsl")) implementation(project(":elasticmq-sqs-client")) api(project(":java-dynamic-sqs-listener-ktor-core")) - implementation("io.ktor:ktor-server-netty:1.3.2") - implementation("ch.qos.logback:logback-core") - implementation("ch.qos.logback:logback-classic") + implementation("io.ktor:ktor-server-netty:$ktorVersion") + implementation("ch.qos.logback:logback-core:$logbackVersion") + implementation("ch.qos.logback:logback-classic:$logbackVersion") } tasks.create("runApp") { diff --git a/examples/spring-aws-example/build.gradle.kts b/examples/spring-aws-example/build.gradle.kts index 9f3dfadd..8b18ca95 100644 --- a/examples/spring-aws-example/build.gradle.kts +++ b/examples/spring-aws-example/build.gradle.kts @@ -5,9 +5,10 @@ plugins { id("org.springframework.boot") } +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) - implementation("org.elasticmq:elasticmq-rest-sqs_2.12") - implementation(project(":local-sqs-async-client")) } diff --git a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-consumer/build.gradle.kts b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-consumer/build.gradle.kts index 7ee00820..4e6ff4a4 100644 --- a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-consumer/build.gradle.kts +++ b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-consumer/build.gradle.kts @@ -7,7 +7,10 @@ plugins { id("com.commercehub.gradle.plugin.avro-base") } +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.boot:spring-boot-autoconfigure-processor") diff --git a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer-two/build.gradle.kts b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer-two/build.gradle.kts index 8eb70746..dd017ec9 100644 --- a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer-two/build.gradle.kts +++ b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer-two/build.gradle.kts @@ -7,9 +7,14 @@ plugins { id("com.commercehub.gradle.plugin.avro-base") } +val awsVersion: String by project +val springBootVersion: String by project + dependencies { + api(platform("software.amazon.awssdk:bom:$awsVersion")) + api("software.amazon.awssdk:sqs") + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") - implementation("software.amazon.awssdk:sqs") implementation(project(":avro-spring-cloud-schema-registry-sqs-client")) } diff --git a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer/build.gradle.kts b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer/build.gradle.kts index 027f8653..0b1f2c4c 100644 --- a/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer/build.gradle.kts +++ b/examples/spring-cloud-schema-registry-example/spring-cloud-schema-registry-producer/build.gradle.kts @@ -7,9 +7,14 @@ plugins { id("com.commercehub.gradle.plugin.avro-base") } +val awsVersion: String by project +val springBootVersion: String by project + dependencies { + api(platform("software.amazon.awssdk:bom:$awsVersion")) + api("software.amazon.awssdk:sqs") + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") - implementation("software.amazon.awssdk:sqs") implementation(project(":avro-spring-cloud-schema-registry-sqs-client")) } diff --git a/examples/spring-integration-test-example/build.gradle.kts b/examples/spring-integration-test-example/build.gradle.kts index 0b0bd56e..66253314 100644 --- a/examples/spring-integration-test-example/build.gradle.kts +++ b/examples/spring-integration-test-example/build.gradle.kts @@ -5,13 +5,15 @@ plugins { id("org.springframework.boot") } +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) testImplementation("org.springframework:spring-test") testImplementation("org.springframework.boot:spring-boot-test") - testImplementation("org.elasticmq:elasticmq-rest-sqs_2.12") testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":expected-test-exception")) } diff --git a/examples/spring-multiple-aws-account-example/build.gradle.kts b/examples/spring-multiple-aws-account-example/build.gradle.kts index 6c4cef66..db9a9605 100644 --- a/examples/spring-multiple-aws-account-example/build.gradle.kts +++ b/examples/spring-multiple-aws-account-example/build.gradle.kts @@ -5,9 +5,11 @@ plugins { id("org.springframework.boot") } +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) - implementation(project(":local-sqs-async-client")) - implementation("org.elasticmq:elasticmq-rest-sqs_2.12") + implementation(project(":elasticmq-sqs-client")) } diff --git a/examples/spring-multiple-aws-account-example/src/main/java/com/jashmore/sqs/examples/Application.java b/examples/spring-multiple-aws-account-example/src/main/java/com/jashmore/sqs/examples/Application.java index 930b5e7c..10d143cb 100644 --- a/examples/spring-multiple-aws-account-example/src/main/java/com/jashmore/sqs/examples/Application.java +++ b/examples/spring-multiple-aws-account-example/src/main/java/com/jashmore/sqs/examples/Application.java @@ -1,25 +1,17 @@ package com.jashmore.sqs.examples; -import akka.http.scaladsl.Http; +import com.jashmore.sqs.elasticmq.ElasticMqSqsAsyncClient; import com.jashmore.sqs.spring.client.DefaultSqsAsyncClientProvider; import com.jashmore.sqs.spring.client.SqsAsyncClientProvider; import lombok.extern.slf4j.Slf4j; -import org.elasticmq.rest.sqs.SQSRestServer; -import org.elasticmq.rest.sqs.SQSRestServerBuilder; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.sqs.SqsAsyncClient; -import software.amazon.awssdk.services.sqs.model.CreateQueueRequest; -import java.net.URI; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.ExecutionException; @SpringBootApplication @EnableScheduling @@ -39,42 +31,8 @@ public static void main(String[] args) { @Bean public SqsAsyncClientProvider sqsAsyncClientProvider() throws InterruptedException { final Map clientsMap = new HashMap<>(); - clientsMap.put("firstClient", buildClient("firstClientQueue")); - clientsMap.put("secondClient", buildClient("secondClientQueue")); + clientsMap.put("firstClient", new ElasticMqSqsAsyncClient("firstClientQueue")); + clientsMap.put("secondClient", new ElasticMqSqsAsyncClient("secondClientQueue")); return new DefaultSqsAsyncClientProvider(null, clientsMap); } - - /** - * Starts an in-memory ElasticMQ server and returns a {@link SqsAsyncClient} pointing to it, each call to this represents a different AWS Account. - * - *

Note that the region and credentials are hardcoded to fake values as they are not checked but connecting to an actual AWS account here will involve - * reading environment variables or other properties. - * - * @param queueName the name of a queue to create in this SQS Server - * @return the {@link SqsAsyncClient} that points to this SQS Server - * @throws InterruptedException if it was interrupted while creating the queue - */ - private static SqsAsyncClient buildClient(String queueName) throws InterruptedException { - log.info("Starting Local ElasticMQ SQS Server"); - final SQSRestServer sqsRestServer = SQSRestServerBuilder - .withInterface("localhost") - .withDynamicPort() - .start(); - - final Http.ServerBinding serverBinding = sqsRestServer.waitUntilStarted(); - final SqsAsyncClient client = SqsAsyncClient.builder() - .endpointOverride(URI.create("http://localhost:" + serverBinding.localAddress().getPort())) - .region(Region.of("localstack")) - .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("accessKeyId", "secretAccessKey"))) - .build(); - try { - client.createQueue(CreateQueueRequest.builder() - .queueName(queueName) - .build()) - .get(); - } catch (ExecutionException executionException) { - throw new RuntimeException(executionException.getCause()); - } - return client; - } } diff --git a/examples/spring-sleuth-example/build.gradle.kts b/examples/spring-sleuth-example/build.gradle.kts index 1b4517a6..4c0becc4 100644 --- a/examples/spring-sleuth-example/build.gradle.kts +++ b/examples/spring-sleuth-example/build.gradle.kts @@ -5,9 +5,13 @@ plugins { id("org.springframework.boot") } +val springBootVersion: String by project +val springCloudVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.cloud:spring-cloud-starter-zipkin:2.2.3.RELEASE") + implementation("org.springframework.cloud:spring-cloud-starter-zipkin:$springCloudVersion") implementation(project(":java-dynamic-sqs-listener-spring-starter")) implementation(project(":elasticmq-sqs-client")) implementation(project(":brave-extension-spring-boot")) diff --git a/examples/spring-starter-example/build.gradle.kts b/examples/spring-starter-example/build.gradle.kts index e0aed203..4ed7827e 100644 --- a/examples/spring-starter-example/build.gradle.kts +++ b/examples/spring-starter-example/build.gradle.kts @@ -5,9 +5,13 @@ plugins { id("org.springframework.boot") } +val elasticMqVersion: String by project +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) - implementation("org.elasticmq:elasticmq-rest-sqs_2.12") + implementation("org.elasticmq:elasticmq-rest-sqs_2.12:$elasticMqVersion") implementation(project(":local-sqs-async-client")) } diff --git a/examples/spring-starter-minimal-example/build.gradle.kts b/examples/spring-starter-minimal-example/build.gradle.kts index d8177fb2..79be9560 100644 --- a/examples/spring-starter-minimal-example/build.gradle.kts +++ b/examples/spring-starter-minimal-example/build.gradle.kts @@ -5,7 +5,10 @@ plugins { id("org.springframework.boot") } +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) implementation(project(":elasticmq-sqs-client")) diff --git a/examples/sqs-listener-library-comparison/build.gradle.kts b/examples/sqs-listener-library-comparison/build.gradle.kts index 0c30af87..0fcc2104 100644 --- a/examples/sqs-listener-library-comparison/build.gradle.kts +++ b/examples/sqs-listener-library-comparison/build.gradle.kts @@ -5,12 +5,19 @@ plugins { id("org.springframework.boot") } +val awsV1Version: String by project +val elasticMqVersion: String by project +val springBootVersion: String by project +val springCloudMessagingVersion: String by project +val springJmsVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) implementation("org.springframework.boot:spring-boot-starter") implementation(project(":java-dynamic-sqs-listener-spring-starter")) - implementation("org.elasticmq:elasticmq-rest-sqs_2.12") + implementation("org.elasticmq:elasticmq-rest-sqs_2.12:$elasticMqVersion") implementation(project(":local-sqs-async-client")) - implementation("org.springframework.cloud:spring-cloud-aws-messaging:2.1.0.RELEASE") - implementation("org.springframework:spring-jms:5.2.7.RELEASE") - implementation("com.amazonaws:amazon-sqs-java-messaging-lib:1.0.4") + implementation("org.springframework.cloud:spring-cloud-aws-messaging:$springCloudMessagingVersion") + implementation("org.springframework:spring-jms:${springJmsVersion}") + implementation("com.amazonaws:amazon-sqs-java-messaging-lib:${awsV1Version}") } diff --git a/extensions/aws-xray-extension/core/build.gradle.kts b/extensions/aws-xray-extension/core/build.gradle.kts index 340c38ee..b8dd94d3 100644 --- a/extensions/aws-xray-extension/core/build.gradle.kts +++ b/extensions/aws-xray-extension/core/build.gradle.kts @@ -1,8 +1,10 @@ description = "Extension for integration AWS Xray Tracing into the Message Listeners" +val awsXrayVersion: String by project + dependencies { - api("com.amazonaws:aws-xray-recorder-sdk-core") + api("com.amazonaws:aws-xray-recorder-sdk-core:$awsXrayVersion") api(project(":java-dynamic-sqs-listener-api")) implementation(project(":common-utils")) compileOnly(project(":documentation-annotations")) diff --git a/extensions/aws-xray-extension/spring-boot/build.gradle.kts b/extensions/aws-xray-extension/spring-boot/build.gradle.kts index b6c882f8..19d4fa9a 100644 --- a/extensions/aws-xray-extension/spring-boot/build.gradle.kts +++ b/extensions/aws-xray-extension/spring-boot/build.gradle.kts @@ -1,7 +1,11 @@ description = "Extension for integration AWS Xray Tracing into the Message Listeners in a Spring Boot Application" +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) + api(project(":aws-xray-extension-core")) implementation("org.springframework:spring-context") implementation("org.springframework.boot:spring-boot-autoconfigure") diff --git a/extensions/brave-extension/core/build.gradle.kts b/extensions/brave-extension/core/build.gradle.kts index 1a2be0bb..e7c3efe6 100644 --- a/extensions/brave-extension/core/build.gradle.kts +++ b/extensions/brave-extension/core/build.gradle.kts @@ -1,13 +1,15 @@ description = "Message Processing Decorator that adds Brave Tracing to the message listeners" +val braveVersion: String by project + dependencies { api(project(":java-dynamic-sqs-listener-api")) - api("io.zipkin.brave:brave") + api("io.zipkin.brave:brave:$braveVersion") implementation(project(":sqs-brave-tracing")) compileOnly(project(":documentation-annotations")) - testImplementation("io.zipkin.brave:brave-tests") + testImplementation("io.zipkin.brave:brave-tests:$braveVersion") testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":expected-test-exception")) } diff --git a/extensions/brave-extension/spring-boot/build.gradle.kts b/extensions/brave-extension/spring-boot/build.gradle.kts index c8e8b971..8c782118 100644 --- a/extensions/brave-extension/spring-boot/build.gradle.kts +++ b/extensions/brave-extension/spring-boot/build.gradle.kts @@ -1,15 +1,18 @@ description = "Message Processing Decorator that adds Brave Tracing to the message listeners in a Spring Boot Application" +val springBootVersion: String by project +val braveVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) api(project(":brave-extension-core")) compileOnly(project(":documentation-annotations")) - implementation("org.springframework:spring-context") implementation("org.springframework.boot:spring-boot-autoconfigure") testImplementation(project(":sqs-brave-tracing")) - testImplementation("io.zipkin.brave:brave-tests") + testImplementation("io.zipkin.brave:brave-tests:$braveVersion") testImplementation("org.springframework:spring-test") testImplementation("org.springframework.boot:spring-boot-test") testImplementation(project(":elasticmq-sqs-client")) diff --git a/extensions/core-kotlin-dsl/build.gradle.kts b/extensions/core-kotlin-dsl/build.gradle.kts index 604c555e..4d62854c 100644 --- a/extensions/core-kotlin-dsl/build.gradle.kts +++ b/extensions/core-kotlin-dsl/build.gradle.kts @@ -1,11 +1,14 @@ description = "Kotlin DSL for building the Core message listeners" +val jacksonVersion: String by project +val mockitoKotlinVersion: String by project + dependencies { implementation(kotlin("stdlib-jdk8")) api(project(":java-dynamic-sqs-listener-core")) testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":expected-test-exception")) - testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") - testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") + testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") } diff --git a/extensions/spring-cloud-schema-registry-extension/avro-spring-cloud-schema-registry-extension/build.gradle.kts b/extensions/spring-cloud-schema-registry-extension/avro-spring-cloud-schema-registry-extension/build.gradle.kts index d635b318..f5c9592a 100644 --- a/extensions/spring-cloud-schema-registry-extension/avro-spring-cloud-schema-registry-extension/build.gradle.kts +++ b/extensions/spring-cloud-schema-registry-extension/avro-spring-cloud-schema-registry-extension/build.gradle.kts @@ -6,12 +6,16 @@ plugins { id("com.commercehub.gradle.plugin.avro-base") } +val avroVersion: String by project +val springBootVersion: String by project + dependencies { - api("org.apache.avro:avro") + api("org.apache.avro:avro:$avroVersion") api(project(":spring-cloud-schema-registry-extension-api")) compileOnly(project(":documentation-annotations")) + testImplementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":avro-spring-cloud-schema-registry-sqs-client")) diff --git a/extensions/spring-cloud-schema-registry-extension/in-memory-spring-cloud-schema-registry/build.gradle.kts b/extensions/spring-cloud-schema-registry-extension/in-memory-spring-cloud-schema-registry/build.gradle.kts index b830ea81..9e24f7a5 100644 --- a/extensions/spring-cloud-schema-registry-extension/in-memory-spring-cloud-schema-registry/build.gradle.kts +++ b/extensions/spring-cloud-schema-registry-extension/in-memory-spring-cloud-schema-registry/build.gradle.kts @@ -1,7 +1,9 @@ description = "In Memory implementation of the Spring Cloud Schema Registry that is used for testing purposes" +val springCloudSchemaRegistryVersion: String by project + dependencies { compileOnly(project(":documentation-annotations")) - implementation("org.springframework.cloud:spring-cloud-schema-registry-client") + implementation("org.springframework.cloud:spring-cloud-schema-registry-client:$springCloudSchemaRegistryVersion") } diff --git a/extensions/spring-cloud-schema-registry-extension/spring-cloud-schema-registry-extension-api/build.gradle.kts b/extensions/spring-cloud-schema-registry-extension/spring-cloud-schema-registry-extension-api/build.gradle.kts index 03d8abe3..1ff31efb 100644 --- a/extensions/spring-cloud-schema-registry-extension/spring-cloud-schema-registry-extension-api/build.gradle.kts +++ b/extensions/spring-cloud-schema-registry-extension/spring-cloud-schema-registry-extension-api/build.gradle.kts @@ -1,12 +1,13 @@ description = "API for building a payload parser that has been serialized via the schema registered in the Spring Cloud Schema Registry" +val springCloudSchemaRegistryVersion: String by project + dependencies { api(project(":java-dynamic-sqs-listener-api")) - api("org.springframework.cloud:spring-cloud-schema-registry-client") { + api("org.springframework.cloud:spring-cloud-schema-registry-client:$springCloudSchemaRegistryVersion") { exclude(group = "org.apache.avro", module = "avro") } - implementation(project(":annotation-utils")) compileOnly(project(":documentation-annotations")) } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..159cd03c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,24 @@ +# Versions +assertJVersion=3.16.1 +avroVersion=1.10.0 +awsV1Version=1.0.4 +awsVersion=2.13.66 +awsXrayVersion=2.6.1 +braveVersion=5.12.4 +cglibVersion=3.3.0 +elasticMqVersion=0.15.6 +guavaVersion=29.0-jre +jacksonVersion=2.11.1 +junitJupiterVersion=5.6.2 +ktorVersion=1.3.2 +logbackVersion=1.2.3 +lombokVersion=1.18.12 +mockitoVersion=3.4.6 +mockitoKotlinVersion=2.2.0 +slf4jVersion=1.7.30 +spotbugsVersion=4.1.1 +springBootVersion=2.3.2.RELEASE +springCloudVersion=2.2.3.RELEASE +springCloudMessagingVersion=2.2.2.RELEASE +springCloudSchemaRegistryVersion=1.0.7.RELEASE +springJmsVersion=5.2.7.RELEASE diff --git a/ktor/core/build.gradle.kts b/ktor/core/build.gradle.kts index 1d721374..c2b16d66 100644 --- a/ktor/core/build.gradle.kts +++ b/ktor/core/build.gradle.kts @@ -1,14 +1,17 @@ description = "Library for integrating the Java Dynamic Sqs Listener in a Ktor application" +val ktorVersion: String by project +val mockitoKotlinVersion: String by project + dependencies { implementation(kotlin("stdlib-jdk8")) api(project(":java-dynamic-sqs-listener-core")) api(project(":core-kotlin-dsl")) - implementation("io.ktor:ktor-server-core:1.3.2") + implementation("io.ktor:ktor-server-core:$ktorVersion") testImplementation(project(":elasticmq-sqs-client")) testImplementation(project(":expected-test-exception")) - testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") - testImplementation("io.ktor:ktor-server-test-host:1.3.2") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") + testImplementation("io.ktor:ktor-server-test-host:$ktorVersion") } diff --git a/settings.gradle.kts b/settings.gradle.kts index e432d8e8..d7a19913 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,6 +6,9 @@ pluginManagement { id("org.springframework.boot") version "2.3.2.RELEASE" id("com.commercehub.gradle.plugin.avro-base") version "0.21.0" id("org.jlleitschuh.gradle.ktlint") version "9.3.0" + id("com.github.spotbugs") version "4.4.5" + kotlin("jvm") version "1.3.72" + id("io.gitlab.arturbosch.detekt") version "1.10.0" } repositories { gradlePluginPortal() diff --git a/spring/spring-core/build.gradle.kts b/spring/spring-core/build.gradle.kts index 2aefb297..06841b14 100644 --- a/spring/spring-core/build.gradle.kts +++ b/spring/spring-core/build.gradle.kts @@ -1,7 +1,11 @@ description = "Core Spring implementation for the Java Dynamic SQS Listener library" +val springBootVersion: String by project + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) + api(project(":java-dynamic-sqs-listener-spring-api")) api(project(":java-dynamic-sqs-listener-core")) implementation(project(":common-utils")) diff --git a/spring/spring-starter/build.gradle.kts b/spring/spring-starter/build.gradle.kts index 4b5fde1f..2afbc7c8 100644 --- a/spring/spring-starter/build.gradle.kts +++ b/spring/spring-starter/build.gradle.kts @@ -1,14 +1,17 @@ description = "Spring Starter for automatically setting up the Spring Core implementation in a Spring Boot Application" +val springBootVersion: String by project + dependencies { api(project(":java-dynamic-sqs-listener-spring-core")) + testImplementation(project(":elasticmq-sqs-client")) + testImplementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) testImplementation("org.springframework.boot:spring-boot-starter") testImplementation("org.springframework.boot:spring-boot-starter-web") testImplementation("org.springframework:spring-tx") testImplementation("org.springframework:spring-test") testImplementation("org.springframework.boot:spring-boot-test") testImplementation("org.springframework.boot:spring-boot-starter-aop") - testImplementation(project(":elasticmq-sqs-client")) } diff --git a/util/avro-spring-cloud-schema-registry-sqs-client/build.gradle.kts b/util/avro-spring-cloud-schema-registry-sqs-client/build.gradle.kts index bcab3e61..ca9bd63e 100644 --- a/util/avro-spring-cloud-schema-registry-sqs-client/build.gradle.kts +++ b/util/avro-spring-cloud-schema-registry-sqs-client/build.gradle.kts @@ -1,8 +1,13 @@ description = "Wrapper around the AWS SQS Async Client to help serialize messages using Avro and the Spring Cloud Schema Registry" +val avroVersion: String by project +val awsVersion: String by project +val springCloudSchemaRegistryVersion: String by project + dependencies { + api(platform("software.amazon.awssdk:bom:$awsVersion")) api("software.amazon.awssdk:sqs") - api("org.springframework.cloud:spring-cloud-schema-registry-client") - api("org.apache.avro:avro") + api("org.springframework.cloud:spring-cloud-schema-registry-client:$springCloudSchemaRegistryVersion") + api("org.apache.avro:avro:$avroVersion") } diff --git a/util/common-utils/build.gradle.kts b/util/common-utils/build.gradle.kts index ae115205..fc53db82 100644 --- a/util/common-utils/build.gradle.kts +++ b/util/common-utils/build.gradle.kts @@ -1,8 +1,10 @@ description = "Utility methods for dealing with basic functionality for this library, split out so so it can be consumed by other extensions" +val slf4jVersion: String by project + dependencies { - implementation("org.slf4j:slf4j-api") + implementation("org.slf4j:slf4j-api:$slf4jVersion") compileOnly(project(":documentation-annotations")) testImplementation(project(":proxy-method-interceptor")) diff --git a/util/elasticmq-sqs-client/build.gradle.kts b/util/elasticmq-sqs-client/build.gradle.kts index 75e31ccf..483b598c 100644 --- a/util/elasticmq-sqs-client/build.gradle.kts +++ b/util/elasticmq-sqs-client/build.gradle.kts @@ -1,8 +1,9 @@ description = "Provides the ability to create a SqsAsyncClient backed by an in-memory ElasticMQ SQS Server" +val elasticMqVersion: String by project + dependencies { - api("software.amazon.awssdk:sqs") api(project(":local-sqs-async-client")) - implementation("org.elasticmq:elasticmq-rest-sqs_2.12") + implementation("org.elasticmq:elasticmq-rest-sqs_2.12:$elasticMqVersion") } diff --git a/util/local-sqs-async-client/build.gradle.kts b/util/local-sqs-async-client/build.gradle.kts index dc9349ab..e3f8cbb0 100644 --- a/util/local-sqs-async-client/build.gradle.kts +++ b/util/local-sqs-async-client/build.gradle.kts @@ -1,10 +1,15 @@ description = "Provides a local Amazon SQS implementation that can talk to a locally running SQS queue like localstack" +val awsVersion: String by project +val slf4jVersion: String by project +val elasticMqVersion: String by project + dependencies { - implementation("software.amazon.awssdk:sqs") - implementation("org.slf4j:slf4j-api") + api(platform("software.amazon.awssdk:bom:$awsVersion")) + api("software.amazon.awssdk:sqs") + implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation(project(":common-utils")) - testImplementation("org.elasticmq:elasticmq-rest-sqs_2.12") + testImplementation("org.elasticmq:elasticmq-rest-sqs_2.12:$elasticMqVersion") } diff --git a/util/proxy-method-interceptor/build.gradle.kts b/util/proxy-method-interceptor/build.gradle.kts index 22cdc00e..23c49078 100644 --- a/util/proxy-method-interceptor/build.gradle.kts +++ b/util/proxy-method-interceptor/build.gradle.kts @@ -1,6 +1,8 @@ description = "Utility methods for testing a method being proxied via cglib" +val cglibVersion: String by project + dependencies { - api("cglib:cglib") + api("cglib:cglib:$cglibVersion") } diff --git a/util/sqs-brave-tracing/build.gradle.kts b/util/sqs-brave-tracing/build.gradle.kts index 39152087..87169c82 100644 --- a/util/sqs-brave-tracing/build.gradle.kts +++ b/util/sqs-brave-tracing/build.gradle.kts @@ -1,10 +1,14 @@ description = "Helper Util for adding Tracing information to the message attributes of outbound SQS messages" +val awsVersion: String by project +val braveVersion: String by project + dependencies { - api("io.zipkin.brave:brave") + api(platform("software.amazon.awssdk:bom:$awsVersion")) implementation("software.amazon.awssdk:sqs") + api("io.zipkin.brave:brave:$braveVersion") - testImplementation("io.zipkin.brave:brave-tests") + testImplementation("io.zipkin.brave:brave-tests:$braveVersion") testImplementation(project(":elasticmq-sqs-client")) }