diff --git a/common-api/build.gradle b/common-api/build.gradle deleted file mode 100644 index 63fc899..0000000 --- a/common-api/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - id "io.freefair.lombok" version "8.12" - id 'java-library' -} - -group = 'bitxon.common' -version = '1.0-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -repositories { - mavenCentral() -} - -dependencies { - implementation 'jakarta.validation:jakarta.validation-api:3.0.2' - - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/common-api/build.gradle.kts b/common-api/build.gradle.kts new file mode 100644 index 0000000..bbf377f --- /dev/null +++ b/common-api/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + `java-library` + id("io.freefair.lombok") version "9.1.0" +} + +group = "bitxon.common" +version = "1.0-SNAPSHOT" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation("jakarta.validation:jakarta.validation-api:3.0.2") +} diff --git a/common-wiremock/build.gradle b/common-wiremock/build.gradle deleted file mode 100644 index 75c1b40..0000000 --- a/common-wiremock/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - id 'java-library' -} - -group = 'bitxon.common' -version = '1.0-SNAPSHOT' - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} diff --git a/common-wiremock/build.gradle.kts b/common-wiremock/build.gradle.kts new file mode 100644 index 0000000..f634227 --- /dev/null +++ b/common-wiremock/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + `java-library` +} + +group = "bitxon.common" +version = "1.0-SNAPSHOT" diff --git a/dropwizard-app/build.gradle b/dropwizard-app/build.gradle deleted file mode 100644 index a2b400b..0000000 --- a/dropwizard-app/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -plugins { - id 'java' - id 'application' - id 'com.gradleup.shadow' version '9.2.1' -} - -group = 'bitxon.dropwizard' -version = '1.0-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -repositories { - mavenCentral() -} - -dependencies { - implementation project(':common-api') - implementation enforcedPlatform('io.dropwizard:dropwizard-bom:5.0.0') - implementation 'io.dropwizard:dropwizard-core' - implementation 'io.dropwizard:dropwizard-client' - implementation 'io.dropwizard:dropwizard-validation' - implementation 'io.dropwizard:dropwizard-hibernate' - implementation 'org.mapstruct:mapstruct:1.6.3' - - annotationProcessor 'org.projectlombok:lombok:1.18.42' - annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3' - - compileOnly 'org.projectlombok:lombok:1.18.42' - - runtimeOnly 'org.postgresql:postgresql:42.7.8' - - testImplementation 'io.dropwizard:dropwizard-testing' - testImplementation project(':common-wiremock') - testImplementation platform('org.testcontainers:testcontainers-bom:2.0.2') - testImplementation 'org.wiremock:wiremock:3.13.2' - testImplementation 'org.testcontainers:testcontainers' - testImplementation 'org.testcontainers:testcontainers-junit-jupiter' - testImplementation 'org.testcontainers:testcontainers-postgresql' - testImplementation 'org.assertj:assertj-core:3.27.6' - testImplementation 'io.rest-assured:rest-assured:5.5.6' - testImplementation 'org.junit.jupiter:junit-jupiter' - testImplementation 'org.junit.jupiter:junit-jupiter-params' - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'bitxon.dropwizard.DropwizardApplication' -} - -jar { - manifest { - attributes 'Main-Class': application.mainClass - attributes 'Build-Jdk-Spec': java.sourceCompatibility - attributes 'Class-Path': sourceSets.main.runtimeClasspath.collect { it.name }.join(' ') - } -} - -shadowJar { - mergeServiceFiles() - exclude 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF' -} - -run { - args = ['server', 'classpath:config.yml',] -} - diff --git a/dropwizard-app/build.gradle.kts b/dropwizard-app/build.gradle.kts new file mode 100644 index 0000000..6fde80b --- /dev/null +++ b/dropwizard-app/build.gradle.kts @@ -0,0 +1,75 @@ +plugins { + java + application + id("com.gradleup.shadow") version "9.2.1" +} + +group = "bitxon.dropwizard" +version = "1.0-SNAPSHOT" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(project(":common-api")) + implementation(enforcedPlatform("io.dropwizard:dropwizard-bom:5.0.0")) + implementation("io.dropwizard:dropwizard-core") + implementation("io.dropwizard:dropwizard-client") + implementation("io.dropwizard:dropwizard-validation") + implementation("io.dropwizard:dropwizard-hibernate") + implementation("org.mapstruct:mapstruct:1.6.3") + + annotationProcessor("org.projectlombok:lombok:1.18.42") + annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3") + + compileOnly("org.projectlombok:lombok:1.18.42") + + runtimeOnly("org.postgresql:postgresql:42.7.8") + + testImplementation("io.dropwizard:dropwizard-testing") + testImplementation(project(":common-wiremock")) + testImplementation(platform("org.testcontainers:testcontainers-bom:2.0.2")) + testImplementation("org.wiremock:wiremock:3.13.2") + testImplementation("org.testcontainers:testcontainers") + testImplementation("org.testcontainers:testcontainers-junit-jupiter") + testImplementation("org.testcontainers:testcontainers-postgresql") + testImplementation("org.assertj:assertj-core:3.27.6") + testImplementation("io.rest-assured:rest-assured:5.5.6") + testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation("org.junit.jupiter:junit-jupiter-params") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") +} + +tasks.test { + useJUnitPlatform() +} + +application { + mainClass.set("bitxon.dropwizard.DropwizardApplication") +} + +tasks.jar { + manifest { + attributes( + "Main-Class" to application.mainClass.get(), + "Build-Jdk-Spec" to java.sourceCompatibility, + "Class-Path" to sourceSets.main.get().runtimeClasspath.files.joinToString(" ") { it.name } + ) + } +} + +tasks.shadowJar { + mergeServiceFiles() + exclude("META-INF/*.DSA", "META-INF/*.RSA", "META-INF/*.SF") +} + +tasks.named("run") { + args = listOf("server", "classpath:config.yml") +} diff --git a/loadtest/build.gradle b/loadtest/build.gradle deleted file mode 100644 index cfad8ce..0000000 --- a/loadtest/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'io.gatling.gradle' version '3.14.9' -} - -group = 'bitxon' -version = '1.0-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -repositories { - mavenCentral() -} - -gatling { - enterprise { - // Enterprise Cloud (https://cloud.gatling.io/) configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-cloud - // Enterprise Self-Hosted configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-self-hosted - } -} diff --git a/loadtest/build.gradle.kts b/loadtest/build.gradle.kts new file mode 100644 index 0000000..5dbb286 --- /dev/null +++ b/loadtest/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + java + id("io.gatling.gradle") version "3.14.9" +} + +group = "bitxon" +version = "1.0-SNAPSHOT" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +repositories { + mavenCentral() +} + + gatling { + enterprise.closureOf { + // Enterprise Cloud (https://cloud.gatling.io/) configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-cloud + // Enterprise Self-Hosted configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-self-hosted + } + } diff --git a/micronaut-app/build.gradle b/micronaut-app/build.gradle.kts similarity index 68% rename from micronaut-app/build.gradle rename to micronaut-app/build.gradle.kts index 8989b78..cc34222 100644 --- a/micronaut-app/build.gradle +++ b/micronaut-app/build.gradle.kts @@ -5,12 +5,12 @@ plugins { id("io.micronaut.aot") version "4.6.1" } -group = 'bitxon.micronaut' -version = '1.0-SNAPSHOT' +group = "bitxon.micronaut" +version = "1.0-SNAPSHOT" java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion.set(JavaLanguageVersion.of(21)) } } @@ -19,7 +19,7 @@ repositories { } dependencies { - implementation project(":common-api") + implementation(project(":common-api")) annotationProcessor("org.projectlombok:lombok") annotationProcessor("org.mapstruct:mapstruct-processor:1.5.3.Final") annotationProcessor("io.micronaut.data:micronaut-data-processor") @@ -44,12 +44,12 @@ dependencies { testImplementation("org.testcontainers:junit-jupiter") testImplementation("org.testcontainers:postgresql") testImplementation("org.testcontainers:testcontainers") - testImplementation project(":common-wiremock") + testImplementation(project(":common-wiremock")) testImplementation("org.wiremock:wiremock:3.13.2") - testImplementation 'org.eclipse.jetty:jetty-servlet:11.0.26' // wiremock dependency conflict workaround - testImplementation 'org.eclipse.jetty:jetty-servlets:11.0.26' // wiremock dependency conflict workaround - testImplementation 'org.eclipse.jetty:jetty-webapp:11.0.26' // wiremock dependency conflict workaround - testImplementation 'org.eclipse.jetty.http2:http2-server:11.0.26' // wiremock dependency conflict workaround + testImplementation("org.eclipse.jetty:jetty-servlet:11.0.26") // wiremock dependency conflict workaround + testImplementation("org.eclipse.jetty:jetty-servlets:11.0.26") // wiremock dependency conflict workaround + testImplementation("org.eclipse.jetty:jetty-webapp:11.0.26") // wiremock dependency conflict workaround + testImplementation("org.eclipse.jetty.http2:http2-server:11.0.26") // wiremock dependency conflict workaround testRuntimeOnly("org.junit.platform:junit-platform-launcher") } @@ -57,7 +57,8 @@ application { mainClass.set("bitxon.micronaut.MicronautApplication") } -graalvmNative.toolchainDetection = false +graalvmNative.toolchainDetection.set(false) + micronaut { version("4.10.3") runtime("netty") @@ -69,18 +70,17 @@ micronaut { aot { // Please review carefully the optimizations enabled below // Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details - optimizeServiceLoading = false - convertYamlToJava = false - precomputeOperations = true - cacheEnvironment = true - optimizeClassLoading = true - deduceEnvironment = true - optimizeNetty = true - replaceLogbackXml = true + optimizeServiceLoading.set(false) + convertYamlToJava.set(false) + precomputeOperations.set(true) + cacheEnvironment.set(true) + optimizeClassLoading.set(true) + deduceEnvironment.set(true) + optimizeNetty.set(true) + replaceLogbackXml.set(true) } } -tasks.named("dockerfileNative") { +tasks.named("dockerfileNative") { jdkVersion = "21" } - diff --git a/quarkus-app/build.gradle b/quarkus-app/build.gradle deleted file mode 100644 index e56a924..0000000 --- a/quarkus-app/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id 'java' - id 'io.quarkus' version '3.30.1' -} - -ext.set("quarkus.package.jar.type", "uber-jar") // ['fast-jar', 'uber-jar', 'mutable-jar'] - -group = 'bitxon.quarkus' -version = '1.0-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - annotationProcessor 'org.projectlombok:lombok:1.18.36' - annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final' - implementation project(":common-api") - implementation enforcedPlatform("io.quarkus.platform:quarkus-bom:3.30.1") - implementation 'io.quarkus:quarkus-arc' - implementation 'io.quarkus:quarkus-rest-jackson' - implementation 'io.quarkus:quarkus-rest-client-jackson' - implementation 'io.quarkus:quarkus-smallrye-health' - implementation 'io.quarkus:quarkus-hibernate-validator' - implementation 'io.quarkus:quarkus-hibernate-orm-panache' - implementation 'io.quarkus:quarkus-jdbc-postgresql' - implementation 'org.mapstruct:mapstruct:1.5.3.Final' - compileOnly 'org.projectlombok:lombok:1.18.36' - testImplementation 'io.quarkus:quarkus-junit5' - testImplementation 'io.rest-assured:rest-assured' - testImplementation 'org.testcontainers:junit-jupiter' - testImplementation 'org.testcontainers:postgresql' - testImplementation 'org.testcontainers:testcontainers' - testImplementation 'org.wiremock:wiremock:3.13.2' - testImplementation project(":common-wiremock") -} - -test { - systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" - jvmArgs "--add-opens", "java.base/java.lang=ALL-UNNAMED" -} - -compileJava { - options.encoding = 'UTF-8' - options.compilerArgs << '-parameters' -} - -compileTestJava { - options.encoding = 'UTF-8' -} diff --git a/quarkus-app/build.gradle.kts b/quarkus-app/build.gradle.kts new file mode 100644 index 0000000..c3060ec --- /dev/null +++ b/quarkus-app/build.gradle.kts @@ -0,0 +1,53 @@ +plugins { + java + id("io.quarkus") version "3.30.1" +} + +extra["quarkus.package.jar.type"] = "uber-jar" // ['fast-jar', 'uber-jar', 'mutable-jar'] + +group = "bitxon.quarkus" +version = "1.0-SNAPSHOT" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +repositories { + mavenCentral() + mavenLocal() +} + +dependencies { + annotationProcessor("org.projectlombok:lombok:1.18.36") + annotationProcessor("org.mapstruct:mapstruct-processor:1.5.3.Final") + implementation(project(":common-api")) + implementation(enforcedPlatform("io.quarkus.platform:quarkus-bom:3.30.1")) + implementation("io.quarkus:quarkus-arc") + implementation("io.quarkus:quarkus-rest-jackson") + implementation("io.quarkus:quarkus-rest-client-jackson") + implementation("io.quarkus:quarkus-smallrye-health") + implementation("io.quarkus:quarkus-hibernate-validator") + implementation("io.quarkus:quarkus-hibernate-orm-panache") + implementation("io.quarkus:quarkus-jdbc-postgresql") + implementation("org.mapstruct:mapstruct:1.5.3.Final") + compileOnly("org.projectlombok:lombok:1.18.36") + testImplementation("io.quarkus:quarkus-junit5") + testImplementation("io.rest-assured:rest-assured") + testImplementation("org.testcontainers:junit-jupiter") + testImplementation("org.testcontainers:postgresql") + testImplementation("org.testcontainers:testcontainers") + testImplementation("org.wiremock:wiremock:3.13.2") + testImplementation(project(":common-wiremock")) +} + +tasks.withType { + systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager") + jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") +} + +tasks.withType { + options.encoding = "UTF-8" + options.compilerArgs.add("-parameters") +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 0c44339..0000000 --- a/settings.gradle +++ /dev/null @@ -1,8 +0,0 @@ -rootProject.name = 'java-microservices' -include 'common-api' -include 'common-wiremock' -include 'spring-app' -include 'dropwizard-app' -include 'micronaut-app' -include 'quarkus-app' -include 'loadtest' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..9236e4f --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,9 @@ +rootProject.name = "java-microservices" + +include("common-api") +include("common-wiremock") +include("spring-app") +include("dropwizard-app") +include("micronaut-app") +include("quarkus-app") +include("loadtest") diff --git a/spring-app/build.gradle b/spring-app/build.gradle deleted file mode 100644 index 4d3a35f..0000000 --- a/spring-app/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id 'java' - id 'org.springframework.boot' version '4.0.0' - id 'io.spring.dependency-management' version '1.1.7' -} - -group = 'bitxon.spring' -version = '1.0-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -configurations { - compileOnly { - extendsFrom annotationProcessor - } -} - -repositories { - mavenCentral() -} - -dependencyManagement { - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2025.1.0' - } -} - -dependencies { - implementation project(":common-api") - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-restclient' - implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.mapstruct:mapstruct:1.6.3' - - annotationProcessor("org.projectlombok:lombok") - annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3' - - compileOnly("org.projectlombok:lombok") - - runtimeOnly 'org.postgresql:postgresql' - - if (System.getProperty("os.arch") == "aarch64") { - //TODO find better way to do it conditionally - runtimeOnly 'io.netty:netty-resolver-dns-native-macos:4.1.92.Final:osx-aarch_64' - } - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.boot:spring-boot-testcontainers' - testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner' - testImplementation project(":common-wiremock") - testImplementation 'org.testcontainers:testcontainers-junit-jupiter' - testImplementation 'org.testcontainers:testcontainers-postgresql' - testImplementation 'io.rest-assured:rest-assured:6.0.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/spring-app/build.gradle.kts b/spring-app/build.gradle.kts new file mode 100644 index 0000000..869fb0e --- /dev/null +++ b/spring-app/build.gradle.kts @@ -0,0 +1,66 @@ +plugins { + java + id("org.springframework.boot") version "4.0.0" + id("io.spring.dependency-management") version "1.1.7" +} + +group = "bitxon.spring" +version = "1.0-SNAPSHOT" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +configurations { + compileOnly { + extendsFrom(configurations.annotationProcessor.get()) + } +} + +repositories { + mavenCentral() +} + +extra["springCloudVersion"] = "2025.1.0" + +dependencyManagement { + imports { + mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}") + } +} + +dependencies { + implementation(project(":common-api")) + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-restclient") + implementation("org.springframework.boot:spring-boot-starter-validation") + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework.boot:spring-boot-starter-data-jpa") + implementation("org.mapstruct:mapstruct:1.6.3") + + annotationProcessor("org.projectlombok:lombok") + annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3") + + compileOnly("org.projectlombok:lombok") + + runtimeOnly("org.postgresql:postgresql") + + if (System.getProperty("os.arch") == "aarch64") { + //TODO find better way to do it conditionally + runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.1.92.Final:osx-aarch_64") + } + + testImplementation("org.springframework.boot:spring-boot-starter-test") + testImplementation("org.springframework.boot:spring-boot-testcontainers") + testImplementation("org.springframework.cloud:spring-cloud-starter-contract-stub-runner") + testImplementation(project(":common-wiremock")) + testImplementation("org.testcontainers:testcontainers-junit-jupiter") + testImplementation("org.testcontainers:testcontainers-postgresql") + testImplementation("io.rest-assured:rest-assured:6.0.0") +} + +tasks.withType { + useJUnitPlatform() +}