From 3fdf27a5c8d3ffbb3a9fae837e01c176af83946e Mon Sep 17 00:00:00 2001 From: KimDoubleB Date: Mon, 16 Sep 2024 16:24:26 +0900 Subject: [PATCH 1/5] chore: update gradle plugins for java, java-library, application --- build.gradle.kts | 17 +++++++++++------ piikii-bootstrap/build.gradle.kts | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e60b682e..6d29e7aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,14 +2,15 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { + `java-library` alias(libs.plugins.springBoot) alias(libs.plugins.springDependencyManagement) + alias(libs.plugins.kotlin) alias(libs.plugins.kotlinSpring) alias(libs.plugins.kotlinJpa) alias(libs.plugins.kotlinKapt) alias(libs.plugins.ktLint) - application } allprojects { @@ -28,15 +29,19 @@ allprojects { subprojects { apply { - plugin("org.jetbrains.kotlin.jvm") - plugin("org.jetbrains.kotlin.plugin.spring") + // java + plugin("java-library") + + // spring boot plugin("org.springframework.boot") + plugin("io.spring.dependency-management") + + // kotlin plugin("kotlin") - plugin("java-library") + plugin("org.jetbrains.kotlin.jvm") + plugin("org.jetbrains.kotlin.plugin.spring") plugin("kotlin-jpa") - plugin("io.spring.dependency-management") plugin("kotlin-kapt") - plugin("application") plugin("org.jlleitschuh.gradle.ktlint") } diff --git a/piikii-bootstrap/build.gradle.kts b/piikii-bootstrap/build.gradle.kts index 418b82c2..59a263ea 100644 --- a/piikii-bootstrap/build.gradle.kts +++ b/piikii-bootstrap/build.gradle.kts @@ -1,3 +1,7 @@ +plugins { + application +} + dependencyManagement { imports { mavenBom("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:2.6.0") From 2e9e04e65244ef8910c52a784b0e27173079e8e0 Mon Sep 17 00:00:00 2001 From: KimDoubleB Date: Mon, 16 Sep 2024 20:25:51 +0900 Subject: [PATCH 2/5] chore: update libs.version.toml --- gradle/libs.versions.toml | 46 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3dfe2a78..bad53423 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,14 +5,9 @@ kotlin = "2.0.0" jpaPlugin = "2.0.0" kaptPlugin = "2.0.0" ktLint = "12.1.1" +jaxb = "2.3.1" javaVersion = "21" -[libraries] -springBoot = { module = "org.springframework.boot:spring-boot-gradle-plugin", version.ref = "springBoot" } -springDependencyManagement = { module = "io.spring.gradle:dependency-management-plugin", version.ref = "springDependencyManagement" } -kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } -ktLint = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktLint" } - [plugins] springBoot = { id = "org.springframework.boot", version.ref = "springBoot" } springDependencyManagement = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" } @@ -21,3 +16,42 @@ kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotli kotlinJpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "jpaPlugin" } kotlinKapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kaptPlugin" } ktLint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLint" } + +[libraries] +kotlin-jackson = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin" } +kotlin-refelct = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } +kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging-jvm", version = "3.0.5" } + +spring-web = { group = "org.springframework", name = "spring-web" } +spring-transaction = { group = "org.springframework", name = "spring-tx" } +spring-kafka = { group = "org.springframework.kafka", name = "spring-kafka" } + +spring-boot-starter-autoconfigure = { group = "org.springframework.boot", name = "spring-boot-autoconfigure" } +spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web" } +spring-boot-starter-aop = { group = "org.springframework.boot", name = "spring-boot-starter-aop" } +spring-boot-starter-actuator = { group = "org.springframework.boot", name = "spring-boot-starter-actuator" } +spring-boot-starter-validation = { group = "org.springframework.boot", name = "spring-boot-starter-validation" } +spring-boot-starter-cache = { group = "org.springframework.boot", name = "spring-boot-starter-cache" } +spring-boot-starter-jpa = { group = "org.springframework.boot", name = "spring-boot-starter-data-jpa" } +spring-boot-starter-redis = { group = "org.springframework.boot", name = "spring-boot-starter-data-redis" } +spring-boot-docs = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version = "2.5.0" } + +postgresql = { group = "org.postgresql", name = "postgresql" } +caffeine = { group = "com.github.ben-manes.caffeine", name = "caffeine" } +opentelemetry-starter = { group = "io.opentelemetry.instrumentation", name = "opentelemetry-spring-boot-starter" } +micrometer-prometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus" } + +aws-sdk-s3 = { group = "com.amazonaws", name = "aws-java-sdk-s3", version = "1.11.238" } +jaxb-api = { group = "javax.xml.bind", name = "jaxb-api", version.ref = "jaxb" } +jaxb-runtime = { group = "org.glassfish.jaxb", name = "jaxb-runtime", version.ref = "jaxb" } + +spring-boot-annotation-processor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor" } +spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test" } +kotlin-junit5 = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit5" } +junit = { group = "org.junit.platform", name = "junit-platform-launcher" } + +[bundles] +kotlin-spring = ["kotlin-refelct", "kotlin-jackson", "kotlin-logging"] +spring-autoconfigure = ["spring-boot-starter-autoconfigure"] +test-implementation = ["spring-boot-starter-test", "kotlin-junit5"] +test-runtime = ["junit"] From ffc6378b0aa58c0dd9e88e48d2628e4fad088428 Mon Sep 17 00:00:00 2001 From: KimDoubleB Date: Wed, 18 Sep 2024 18:11:34 +0900 Subject: [PATCH 3/5] chore: apply version catalog using buildSrc --- build.gradle.kts | 117 ------------------ buildSrc/build.gradle.kts | 23 ++++ buildSrc/settings.gradle.kts | 37 ++++++ .../main/kotlin/piikii-convention.gradle.kts | 69 +++++++++++ gradle/libs.versions.toml | 22 ++-- piikii-application/build.gradle.kts | 10 +- piikii-bootstrap/build.gradle.kts | 89 +++++++------ .../main/resources/application-actuator.yml | 2 + piikii-common/build.gradle.kts | 14 +-- piikii-input-http/build.gradle.kts | 31 ++--- piikii-output-cache/build.gradle.kts | 26 ---- piikii-output-cache/caffeine/build.gradle.kts | 8 ++ piikii-output-cache/redis/build.gradle.kts | 9 ++ piikii-output-eventbroker/build.gradle.kts | 19 --- .../kafka/build.gradle.kts | 8 ++ piikii-output-persistence/build.gradle.kts | 25 ---- .../postgresql/build.gradle.kts | 15 +++ piikii-output-storage/build.gradle.kts | 24 ---- piikii-output-storage/ncp/build.gradle.kts | 13 ++ piikii-output-web/avocado/build.gradle.kts | 8 ++ piikii-output-web/build.gradle.kts | 24 ---- piikii-output-web/lemon/build.gradle.kts | 8 ++ piikii-output-web/tmap/build.gradle.kts | 8 ++ settings.gradle.kts | 13 +- 24 files changed, 294 insertions(+), 328 deletions(-) delete mode 100644 build.gradle.kts create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/settings.gradle.kts create mode 100644 buildSrc/src/main/kotlin/piikii-convention.gradle.kts delete mode 100644 piikii-output-cache/build.gradle.kts create mode 100644 piikii-output-cache/caffeine/build.gradle.kts create mode 100644 piikii-output-cache/redis/build.gradle.kts delete mode 100644 piikii-output-eventbroker/build.gradle.kts create mode 100644 piikii-output-eventbroker/kafka/build.gradle.kts delete mode 100644 piikii-output-persistence/build.gradle.kts create mode 100644 piikii-output-persistence/postgresql/build.gradle.kts delete mode 100644 piikii-output-storage/build.gradle.kts create mode 100644 piikii-output-storage/ncp/build.gradle.kts create mode 100644 piikii-output-web/avocado/build.gradle.kts delete mode 100644 piikii-output-web/build.gradle.kts create mode 100644 piikii-output-web/lemon/build.gradle.kts create mode 100644 piikii-output-web/tmap/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 6d29e7aa..00000000 --- a/build.gradle.kts +++ /dev/null @@ -1,117 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - `java-library` - alias(libs.plugins.springBoot) - alias(libs.plugins.springDependencyManagement) - - alias(libs.plugins.kotlin) - alias(libs.plugins.kotlinSpring) - alias(libs.plugins.kotlinJpa) - alias(libs.plugins.kotlinKapt) - alias(libs.plugins.ktLint) -} - -allprojects { - group = "com.piikii" - version = "0.0.1-SNAPSHOT" - - repositories { - mavenCentral() - } - - tasks.withType().configureEach { - options.isIncremental = true - options.isFork = true - } -} - -subprojects { - apply { - // java - plugin("java-library") - - // spring boot - plugin("org.springframework.boot") - plugin("io.spring.dependency-management") - - // kotlin - plugin("kotlin") - plugin("org.jetbrains.kotlin.jvm") - plugin("org.jetbrains.kotlin.plugin.spring") - plugin("kotlin-jpa") - plugin("kotlin-kapt") - plugin("org.jlleitschuh.gradle.ktlint") - } - - dependencies { - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.springframework.boot:spring-boot-autoconfigure") - implementation("io.github.microutils:kotlin-logging-jvm:3.0.5") - - testImplementation("org.springframework.boot:spring-boot-starter-test") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - } - - tasks.getByName("bootJar") { - mainClass.set("com.piikii.bootstrap.PiikiiBootstrapApplicationKt") - } - - tasks.withType { - compilerOptions { - jvmTarget.set(JvmTarget.JVM_21) - freeCompilerArgs.addAll("-Xjsr305=strict") - } - } - - tasks.withType { - useJUnitPlatform() - } - - tasks.named("bootJar") { - dependsOn("ktlintFormat") - } -} - -configure(allprojects.filter { it.name != "piikii-common" }) { - dependencies { - implementation(project(":piikii-common")) - } -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(libs.versions.javaVersion.get()) - -tasks.bootJar { - enabled = false -} - -configurations.all { - resolutionStrategy { - cacheDynamicVersionsFor(10 * 60, TimeUnit.SECONDS) - cacheChangingModulesFor(4, TimeUnit.HOURS) - } -} - -develocity { - buildScan { - projectId.set("piikii-application") - - termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use") - termsOfUseAgree.set("yes") - - link("VCS", "https://github.com/mash-up-kr/piikii_Spring/tree/develop") - value("hash", System.getenv("CURRENT_GIT_SHA")) - value("status", System.getenv("STATUS")) - - buildFinished { - if (this.failures.isNotEmpty()) { - val failureMessages = this.failures.mapNotNull { it.message }.joinToString(",") { it } - value("Failed with", failureMessages) - } - } - // default false option: 추후 많은 빌드로 인해 이슈가 생길 때를 대비 - // publishing.onlyIf { false } - } -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..3d8e5000 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,23 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +fun plugin(provider: Provider) = with(provider.get()) { + "$pluginId:$pluginId.gradle.plugin:$version" +} + +dependencies { + implementation(plugin(libs.plugins.spring.boot)) + implementation(plugin(libs.plugins.spring.dependency.management)) + implementation(plugin(libs.plugins.kotlin.jvm)) + implementation(plugin(libs.plugins.kotlin.kapt)) + implementation(plugin(libs.plugins.kotlin.spring)) + implementation(plugin(libs.plugins.kotlin.jpa)) + implementation(plugin(libs.plugins.kotlin.lint)) + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 00000000..71c25303 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,37 @@ +rootProject.name = "piikii-convention" + +plugins { + id("com.gradle.develocity") version ("3.17.6") +} + +develocity { + buildScan { + projectId.set("piikii-application") + + termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use") + termsOfUseAgree.set("yes") + + link("VCS", "https://github.com/mash-up-kr/piikii_Spring/tree/develop") + value("hash", System.getenv("CURRENT_GIT_SHA")) + value("status", System.getenv("STATUS")) + + buildFinished { + if (this.failures.isNotEmpty()) { + val failureMessages = this.failures.mapNotNull { it.message }.joinToString(",") { it } + value("Failed with", failureMessages) + } + } + // default false option: 추후 많은 빌드로 인해 이슈가 생길 때를 대비 + // publishing.onlyIf { false } + } +} + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + + diff --git a/buildSrc/src/main/kotlin/piikii-convention.gradle.kts b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts new file mode 100644 index 00000000..f1a48617 --- /dev/null +++ b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts @@ -0,0 +1,69 @@ +import org.gradle.accessors.dm.LibrariesForLibs +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +val libs = the() + +plugins { + `java-library` + id("org.springframework.boot") + id("io.spring.dependency-management") + id("org.jetbrains.kotlin.jvm") + id("org.jetbrains.kotlin.kapt") + id("org.jetbrains.kotlin.plugin.spring") + id("org.jetbrains.kotlin.plugin.jpa") + id("org.jlleitschuh.gradle.ktlint") +} + +repositories { + mavenCentral() +} + +group = "com.piikii" +version = "0.0.1-SNAPSHOT" + +dependencies { + implementation("com.fasterxml.jackson.module:jackson-module-kotlin") + implementation("org.jetbrains.kotlin:kotlin-reflect") + implementation("org.springframework.boot:spring-boot-autoconfigure") + implementation("io.github.microutils:kotlin-logging-jvm:3.0.5") + + testImplementation("org.springframework.boot:spring-boot-starter-test") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") +} + +// piikii common 의존성 전체 추가 +configure(allprojects.filter { it.name != "piikii-common" }) { + dependencies { + implementation(project(":piikii-common")) + } +} + +java.toolchain.languageVersion = JavaLanguageVersion.of(libs.versions.javaVersion.get()) + +tasks { + bootJar { + enabled = false + } + jar { + enabled = true + } + + withType { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_21) + freeCompilerArgs.addAll("-Xjsr305=strict") + } + } + + withType { + useJUnitPlatform() + } +} + +configurations.all { + resolutionStrategy { + cacheDynamicVersionsFor(10 * 60, TimeUnit.SECONDS) + cacheChangingModulesFor(4, TimeUnit.HOURS) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bad53423..09f99307 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,21 +1,21 @@ [versions] springBoot = "3.3.0" springDependencyManagement = "1.1.5" -kotlin = "2.0.0" -jpaPlugin = "2.0.0" -kaptPlugin = "2.0.0" -ktLint = "12.1.1" +kotlinPlugin = "2.0.0" +ktLintPlugin = "12.1.1" +gradleBuildScanPlugin = "3.18.1" jaxb = "2.3.1" javaVersion = "21" [plugins] -springBoot = { id = "org.springframework.boot", version.ref = "springBoot" } -springDependencyManagement = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" } -kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } -kotlinJpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "jpaPlugin" } -kotlinKapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kaptPlugin" } -ktLint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLint" } +spring-boot = { id = "org.springframework.boot", version.ref = "springBoot" } +spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinPlugin" } +kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlinPlugin" } +kotlin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlinPlugin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlinPlugin" } +kotlin-lint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLintPlugin" } +gradle-develocity = { id = "com.gradle.develocity", version.ref = "gradleBuildScanPlugin" } [libraries] kotlin-jackson = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin" } diff --git a/piikii-application/build.gradle.kts b/piikii-application/build.gradle.kts index 84c1cccd..c6611a8b 100644 --- a/piikii-application/build.gradle.kts +++ b/piikii-application/build.gradle.kts @@ -1,3 +1,7 @@ +plugins { + id("piikii-convention") +} + dependencies { // for docs implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0") @@ -6,10 +10,4 @@ dependencies { implementation("org.springframework:spring-tx:6.1.10") } -tasks.bootJar { - enabled = false -} -tasks.jar { - enabled = true -} diff --git a/piikii-bootstrap/build.gradle.kts b/piikii-bootstrap/build.gradle.kts index 59a263ea..bce0778c 100644 --- a/piikii-bootstrap/build.gradle.kts +++ b/piikii-bootstrap/build.gradle.kts @@ -1,5 +1,6 @@ plugins { application + id("piikii-convention") } dependencyManagement { @@ -10,7 +11,6 @@ dependencyManagement { dependencies { implementation(project(":piikii-input-http")) - implementation(project(":piikii-output-eventbroker:kafka")) implementation(project(":piikii-output-persistence:postgresql")) implementation(project(":piikii-output-cache:redis")) implementation(project(":piikii-output-cache:caffeine")) @@ -23,47 +23,60 @@ dependencies { implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter") runtimeOnly("io.micrometer:micrometer-registry-prometheus") testImplementation(project(":piikii-application")) + + // 현재 미사용으로 의존성 추가 제외 + // implementation(project(":piikii-output-eventbroker:kafka")) } -tasks.getByName("bootBuildImage") { - imageName.set("${System.getenv("NCP_CONTAINER_REGISTRY")}/piikii") - environment.set( - mapOf( - "BP_JVM_VERSION" to "21", - "BPE_SPRING_PROFILES_ACTIVE" to "prod", - "BPE_JAVA_TOOL_OPTIONS" to - buildString { - // G1 GC - append("-XX:+UseG1GC ") - // Container JVM - append("-XX:+UseContainerSupport ") - // Heap 메모리 설정 2G - append("-Xms2g -Xmx2g ") - // OOM시 Heap Dump - append("-XX:+HeapDumpOnOutOfMemoryError ") - // OOM시 Heap Dump 로그 생성 경로 (파일 이름 : 발생한 시각) - append("-XX:HeapDumpPath=/root/heapDump/%Y%m%d_%H%M%S.hprof ") - // 중복 문자열 제거로 메모리 절약 - append("-XX:+UseStringDeduplication ") - // OOM시 애플리케이션 즉시 종료 - append("-XX:+ExitOnOutOfMemoryError ") - // Encoding - append("-Dfile.encoding=UTF-8") - }, - ), - ) - docker { - publishRegistry { - url.set(System.getenv("NCP_CONTAINER_REGISTRY")) - username.set(System.getenv("NCP_API_ACCESS_KEY")) - password.set(System.getenv("NCP_API_SECRET_KEY")) - } +tasks { + bootJar { + enabled = true + } + + named("bootJar") { + dependsOn("ktlintFormat") } - publish.set(true) -} -tasks.bootJar { - enabled = true + getByName("bootJar") { + mainClass.set("com.piikii.bootstrap.PiikiiBootstrapApplicationKt") + } + + getByName("bootBuildImage") { + imageName.set("${System.getenv("NCP_CONTAINER_REGISTRY")}/piikii") + environment.set( + mapOf( + "BP_JVM_VERSION" to "21", + "BPE_SPRING_PROFILES_ACTIVE" to "prod", + "BPE_JAVA_TOOL_OPTIONS" to + buildString { + // G1 GC + append("-XX:+UseG1GC ") + // Container JVM + append("-XX:+UseContainerSupport ") + // Heap 메모리 설정 2G + append("-Xms2g -Xmx2g ") + // OOM시 Heap Dump + append("-XX:+HeapDumpOnOutOfMemoryError ") + // OOM시 Heap Dump 로그 생성 경로 (파일 이름 : 발생한 시각) + append("-XX:HeapDumpPath=/root/heapDump/%Y%m%d_%H%M%S.hprof ") + // 중복 문자열 제거로 메모리 절약 + append("-XX:+UseStringDeduplication ") + // OOM시 애플리케이션 즉시 종료 + append("-XX:+ExitOnOutOfMemoryError ") + // Encoding + append("-Dfile.encoding=UTF-8") + }, + ), + ) + docker { + publishRegistry { + url.set(System.getenv("NCP_CONTAINER_REGISTRY")) + username.set(System.getenv("NCP_API_ACCESS_KEY")) + password.set(System.getenv("NCP_API_SECRET_KEY")) + } + } + publish.set(true) + } } springBoot { diff --git a/piikii-bootstrap/src/main/resources/application-actuator.yml b/piikii-bootstrap/src/main/resources/application-actuator.yml index 7d3f8b9f..a69468be 100644 --- a/piikii-bootstrap/src/main/resources/application-actuator.yml +++ b/piikii-bootstrap/src/main/resources/application-actuator.yml @@ -23,6 +23,8 @@ management: ping: enabled: true endpoint: + info: + enabled: true metrics: enabled: true prometheus: diff --git a/piikii-common/build.gradle.kts b/piikii-common/build.gradle.kts index 00bdbd90..3069e41d 100644 --- a/piikii-common/build.gradle.kts +++ b/piikii-common/build.gradle.kts @@ -1,4 +1,8 @@ -project(":piikii-common") { +plugins { + id("piikii-convention") +} + +dependencies { // for RestClient dependencies { implementation("org.springframework:spring-web") { @@ -10,12 +14,4 @@ project(":piikii-common") { } } -allprojects { - tasks.bootJar { - enabled = false - } - tasks.jar { - enabled = true - } -} diff --git a/piikii-input-http/build.gradle.kts b/piikii-input-http/build.gradle.kts index a2a1d926..54708359 100644 --- a/piikii-input-http/build.gradle.kts +++ b/piikii-input-http/build.gradle.kts @@ -1,26 +1,15 @@ -project(":piikii-input-http") { - dependencies { - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-aop") - - // for docs - implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0") - - // for validation - implementation("org.springframework.boot:spring-boot-starter-validation") - } +plugins { + id("piikii-convention") } -allprojects { - dependencies { - implementation(project(":piikii-application")) - } +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-aop") - tasks.bootJar { - enabled = false - } + // for docs + implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0") - tasks.jar { - enabled = true - } + // for validation + implementation("org.springframework.boot:spring-boot-starter-validation") } diff --git a/piikii-output-cache/build.gradle.kts b/piikii-output-cache/build.gradle.kts deleted file mode 100644 index 66e5369a..00000000 --- a/piikii-output-cache/build.gradle.kts +++ /dev/null @@ -1,26 +0,0 @@ -project(":piikii-output-cache:redis") { - dependencies { - implementation(project(":piikii-application")) - implementation("org.springframework.boot:spring-boot-starter-data-redis") - } -} - -project(":piikii-output-cache:caffeine") { - dependencies { - implementation("com.github.ben-manes.caffeine:caffeine") - } -} - -allprojects { - tasks.bootJar { - enabled = false - } - - tasks.jar { - enabled = true - } - - dependencies { - implementation("org.springframework.boot:spring-boot-starter-cache") - } -} diff --git a/piikii-output-cache/caffeine/build.gradle.kts b/piikii-output-cache/caffeine/build.gradle.kts new file mode 100644 index 00000000..f9cf727f --- /dev/null +++ b/piikii-output-cache/caffeine/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation("org.springframework.boot:spring-boot-starter-cache") + implementation("com.github.ben-manes.caffeine:caffeine") +} diff --git a/piikii-output-cache/redis/build.gradle.kts b/piikii-output-cache/redis/build.gradle.kts new file mode 100644 index 00000000..f04e5207 --- /dev/null +++ b/piikii-output-cache/redis/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework.boot:spring-boot-starter-cache") + implementation("org.springframework.boot:spring-boot-starter-data-redis") +} diff --git a/piikii-output-eventbroker/build.gradle.kts b/piikii-output-eventbroker/build.gradle.kts deleted file mode 100644 index 4e3ef0f6..00000000 --- a/piikii-output-eventbroker/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -project(":piikii-output-eventbroker:kafka") { - dependencies { - implementation("org.springframework.kafka:spring-kafka") - } -} - -allprojects { - dependencies { - implementation(project(":piikii-application")) - } - - tasks.bootJar { - enabled = false - } - - tasks.jar { - enabled = true - } -} diff --git a/piikii-output-eventbroker/kafka/build.gradle.kts b/piikii-output-eventbroker/kafka/build.gradle.kts new file mode 100644 index 00000000..79d5fad8 --- /dev/null +++ b/piikii-output-eventbroker/kafka/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework.kafka:spring-kafka") +} diff --git a/piikii-output-persistence/build.gradle.kts b/piikii-output-persistence/build.gradle.kts deleted file mode 100644 index 5132a7d8..00000000 --- a/piikii-output-persistence/build.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -project(":piikii-output-persistence:postgresql") { - dependencies { - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.postgresql:postgresql") - } - - allOpen { - annotation("jakarta.persistence.Entity") - annotation("jakarta.persistence.MappedSuperclass") - annotation("jakarta.persistence.Embeddable") - } -} - -allprojects { - dependencies { - implementation(project(":piikii-application")) - } - tasks.bootJar { - enabled = false - } - - tasks.jar { - enabled = true - } -} diff --git a/piikii-output-persistence/postgresql/build.gradle.kts b/piikii-output-persistence/postgresql/build.gradle.kts new file mode 100644 index 00000000..6806955d --- /dev/null +++ b/piikii-output-persistence/postgresql/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework.boot:spring-boot-starter-data-jpa") + implementation("org.postgresql:postgresql") +} + +allOpen { + annotation("jakarta.persistence.Entity") + annotation("jakarta.persistence.MappedSuperclass") + annotation("jakarta.persistence.Embeddable") +} diff --git a/piikii-output-storage/build.gradle.kts b/piikii-output-storage/build.gradle.kts deleted file mode 100644 index fdf75a62..00000000 --- a/piikii-output-storage/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -project(":piikii-output-storage:ncp") { - dependencies { - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") - - implementation("org.springframework:spring-web") - implementation("com.amazonaws:aws-java-sdk-s3:1.11.238") - implementation("javax.xml.bind:jaxb-api:2.3.1") - implementation("org.glassfish.jaxb:jaxb-runtime:2.3.1") - } -} - -allprojects { - dependencies { - implementation(project(":piikii-application")) - } - - tasks.bootJar { - enabled = false - } - - tasks.jar { - enabled = true - } -} diff --git a/piikii-output-storage/ncp/build.gradle.kts b/piikii-output-storage/ncp/build.gradle.kts new file mode 100644 index 00000000..6d83f432 --- /dev/null +++ b/piikii-output-storage/ncp/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + + implementation("org.springframework:spring-web") + implementation("com.amazonaws:aws-java-sdk-s3:1.11.238") + implementation("javax.xml.bind:jaxb-api:2.3.1") + implementation("org.glassfish.jaxb:jaxb-runtime:2.3.1") +} diff --git a/piikii-output-web/avocado/build.gradle.kts b/piikii-output-web/avocado/build.gradle.kts new file mode 100644 index 00000000..c81bacc1 --- /dev/null +++ b/piikii-output-web/avocado/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework:spring-web") +} diff --git a/piikii-output-web/build.gradle.kts b/piikii-output-web/build.gradle.kts deleted file mode 100644 index 2943aa3f..00000000 --- a/piikii-output-web/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -project(":piikii-output-web:avocado") { - dependencies { - } -} - -project(":piikii-output-web:lemon") { - dependencies { - } -} - -allprojects { - dependencies { - implementation("org.springframework:spring-web") - implementation(project(":piikii-application")) - } - - tasks.bootJar { - enabled = false - } - - tasks.jar { - enabled = true - } -} diff --git a/piikii-output-web/lemon/build.gradle.kts b/piikii-output-web/lemon/build.gradle.kts new file mode 100644 index 00000000..c81bacc1 --- /dev/null +++ b/piikii-output-web/lemon/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework:spring-web") +} diff --git a/piikii-output-web/tmap/build.gradle.kts b/piikii-output-web/tmap/build.gradle.kts new file mode 100644 index 00000000..c81bacc1 --- /dev/null +++ b/piikii-output-web/tmap/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("piikii-convention") +} + +dependencies { + implementation(project(":piikii-application")) + implementation("org.springframework:spring-web") +} diff --git a/settings.gradle.kts b/settings.gradle.kts index b90ac67d..2854b6f5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,8 @@ -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" - id("com.gradle.develocity") version ("3.17.6") +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } } rootProject.name = "piikii" @@ -9,16 +11,11 @@ include("piikii-application") include("piikii-bootstrap") include("piikii-common") include("piikii-input-http") -include("piikii-output-cache") include("piikii-output-cache:redis") include("piikii-output-cache:caffeine") -include("piikii-output-eventbroker") include("piikii-output-eventbroker:kafka") -include("piikii-output-persistence") include("piikii-output-persistence:postgresql") -include("piikii-output-storage") include("piikii-output-storage:ncp") -include("piikii-output-web") include("piikii-output-web:avocado") include("piikii-output-web:lemon") include("piikii-output-web:tmap") From 7652b34ba5cd4e2fddc9c27a8242fb39e9c30ef8 Mon Sep 17 00:00:00 2001 From: KimDoubleB Date: Wed, 18 Sep 2024 21:56:38 +0900 Subject: [PATCH 4/5] chore: set dependency using version catalog (`libs.versions.toml`) --- .../src/main/kotlin/piikii-convention.gradle.kts | 12 +++++------- gradle/libs.versions.toml | 11 ++++++++++- piikii-application/build.gradle.kts | 8 +------- piikii-bootstrap/build.gradle.kts | 12 ++++++------ piikii-common/build.gradle.kts | 4 +--- piikii-input-http/build.gradle.kts | 9 +-------- piikii-output-cache/caffeine/build.gradle.kts | 3 +-- piikii-output-cache/redis/build.gradle.kts | 3 +-- piikii-output-eventbroker/kafka/build.gradle.kts | 2 +- .../postgresql/build.gradle.kts | 3 +-- piikii-output-storage/ncp/build.gradle.kts | 7 +------ piikii-output-web/avocado/build.gradle.kts | 2 +- piikii-output-web/lemon/build.gradle.kts | 2 +- piikii-output-web/tmap/build.gradle.kts | 2 +- 14 files changed, 32 insertions(+), 48 deletions(-) diff --git a/buildSrc/src/main/kotlin/piikii-convention.gradle.kts b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts index f1a48617..622c3f5c 100644 --- a/buildSrc/src/main/kotlin/piikii-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts @@ -23,13 +23,11 @@ group = "com.piikii" version = "0.0.1-SNAPSHOT" dependencies { - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.springframework.boot:spring-boot-autoconfigure") - implementation("io.github.microutils:kotlin-logging-jvm:3.0.5") - - testImplementation("org.springframework.boot:spring-boot-starter-test") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") + annotationProcessor(libs.spring.boot.annotation.processor) + annotationProcessor(libs.bundles.spring.common) + annotationProcessor(libs.bundles.kotlin.spring) + testImplementation(libs.bundles.test.implementation) + testRuntimeOnly(libs.bundles.test.runtime) } // piikii common 의존성 전체 추가 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 09f99307..b6e5cb0d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,7 +51,16 @@ kotlin-junit5 = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit5" } junit = { group = "org.junit.platform", name = "junit-platform-launcher" } [bundles] +spring-common = ["spring-boot-starter-autoconfigure"] kotlin-spring = ["kotlin-refelct", "kotlin-jackson", "kotlin-logging"] -spring-autoconfigure = ["spring-boot-starter-autoconfigure"] test-implementation = ["spring-boot-starter-test", "kotlin-junit5"] test-runtime = ["junit"] + +bootstarp = ["spring-boot-starter-web", "spring-boot-starter-actuator", "opentelemetry-starter"] +bootstarp-runtime = ["micrometer-prometheus"] +domain-application = ["spring-boot-docs", "spring-transaction"] +adaptor-input-http = ["spring-boot-starter-web", "spring-boot-starter-aop", "spring-boot-docs", "spring-boot-starter-validation"] +adaptor-persistence-postgresql = ["spring-boot-starter-jpa", "postgresql"] +adaptor-storage = ["spring-web", "aws-sdk-s3", "jaxb-api", "jaxb-runtime"] +adaptor-cache-redis = ["spring-boot-starter-cache", "spring-boot-starter-redis"] +adaptor-cache-caffeine = ["spring-boot-starter-cache", "caffeine"] diff --git a/piikii-application/build.gradle.kts b/piikii-application/build.gradle.kts index c6611a8b..2eb01a2d 100644 --- a/piikii-application/build.gradle.kts +++ b/piikii-application/build.gradle.kts @@ -3,11 +3,5 @@ plugins { } dependencies { - // for docs - implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0") - - // for transaction - implementation("org.springframework:spring-tx:6.1.10") + implementation(libs.bundles.domain.application) } - - diff --git a/piikii-bootstrap/build.gradle.kts b/piikii-bootstrap/build.gradle.kts index bce0778c..77e9ea17 100644 --- a/piikii-bootstrap/build.gradle.kts +++ b/piikii-bootstrap/build.gradle.kts @@ -18,14 +18,14 @@ dependencies { implementation(project(":piikii-output-web:avocado")) implementation(project(":piikii-output-web:lemon")) implementation(project(":piikii-output-web:tmap")) - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter") - runtimeOnly("io.micrometer:micrometer-registry-prometheus") + + implementation(libs.bundles.bootstarp) + runtimeOnly(libs.bundles.bootstarp.runtime) + testImplementation(project(":piikii-application")) - // 현재 미사용으로 의존성 추가 제외 - // implementation(project(":piikii-output-eventbroker:kafka")) +// 현재 미사용으로 의존성 추가 제외 +// implementation(project(":piikii-output-eventbroker:kafka")) } tasks { diff --git a/piikii-common/build.gradle.kts b/piikii-common/build.gradle.kts index 3069e41d..d640f45c 100644 --- a/piikii-common/build.gradle.kts +++ b/piikii-common/build.gradle.kts @@ -5,7 +5,7 @@ plugins { dependencies { // for RestClient dependencies { - implementation("org.springframework:spring-web") { + implementation(libs.spring.web) { exclude("org.springframework:spring-beans") exclude("org.springframework:spring-core") exclude("org.springframework:spring-aop") @@ -13,5 +13,3 @@ dependencies { } } } - - diff --git a/piikii-input-http/build.gradle.kts b/piikii-input-http/build.gradle.kts index 54708359..4672dda7 100644 --- a/piikii-input-http/build.gradle.kts +++ b/piikii-input-http/build.gradle.kts @@ -4,12 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-aop") - - // for docs - implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0") - - // for validation - implementation("org.springframework.boot:spring-boot-starter-validation") + implementation(libs.bundles.adaptor.input.http) } diff --git a/piikii-output-cache/caffeine/build.gradle.kts b/piikii-output-cache/caffeine/build.gradle.kts index f9cf727f..362fa51c 100644 --- a/piikii-output-cache/caffeine/build.gradle.kts +++ b/piikii-output-cache/caffeine/build.gradle.kts @@ -3,6 +3,5 @@ plugins { } dependencies { - implementation("org.springframework.boot:spring-boot-starter-cache") - implementation("com.github.ben-manes.caffeine:caffeine") + implementation(libs.bundles.adaptor.cache.caffeine) } diff --git a/piikii-output-cache/redis/build.gradle.kts b/piikii-output-cache/redis/build.gradle.kts index f04e5207..094b29d2 100644 --- a/piikii-output-cache/redis/build.gradle.kts +++ b/piikii-output-cache/redis/build.gradle.kts @@ -4,6 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework.boot:spring-boot-starter-cache") - implementation("org.springframework.boot:spring-boot-starter-data-redis") + implementation(libs.bundles.adaptor.cache.redis) } diff --git a/piikii-output-eventbroker/kafka/build.gradle.kts b/piikii-output-eventbroker/kafka/build.gradle.kts index 79d5fad8..a2cc82bd 100644 --- a/piikii-output-eventbroker/kafka/build.gradle.kts +++ b/piikii-output-eventbroker/kafka/build.gradle.kts @@ -4,5 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework.kafka:spring-kafka") + implementation(libs.spring.kafka) } diff --git a/piikii-output-persistence/postgresql/build.gradle.kts b/piikii-output-persistence/postgresql/build.gradle.kts index 6806955d..4b7106a7 100644 --- a/piikii-output-persistence/postgresql/build.gradle.kts +++ b/piikii-output-persistence/postgresql/build.gradle.kts @@ -4,8 +4,7 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.postgresql:postgresql") + implementation(libs.bundles.adaptor.persistence.postgresql) } allOpen { diff --git a/piikii-output-storage/ncp/build.gradle.kts b/piikii-output-storage/ncp/build.gradle.kts index 6d83f432..eb74c230 100644 --- a/piikii-output-storage/ncp/build.gradle.kts +++ b/piikii-output-storage/ncp/build.gradle.kts @@ -4,10 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") - - implementation("org.springframework:spring-web") - implementation("com.amazonaws:aws-java-sdk-s3:1.11.238") - implementation("javax.xml.bind:jaxb-api:2.3.1") - implementation("org.glassfish.jaxb:jaxb-runtime:2.3.1") + implementation(libs.bundles.adaptor.storage) } diff --git a/piikii-output-web/avocado/build.gradle.kts b/piikii-output-web/avocado/build.gradle.kts index c81bacc1..a262c7ea 100644 --- a/piikii-output-web/avocado/build.gradle.kts +++ b/piikii-output-web/avocado/build.gradle.kts @@ -4,5 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework:spring-web") + implementation(libs.spring.web) } diff --git a/piikii-output-web/lemon/build.gradle.kts b/piikii-output-web/lemon/build.gradle.kts index c81bacc1..a262c7ea 100644 --- a/piikii-output-web/lemon/build.gradle.kts +++ b/piikii-output-web/lemon/build.gradle.kts @@ -4,5 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework:spring-web") + implementation(libs.spring.web) } diff --git a/piikii-output-web/tmap/build.gradle.kts b/piikii-output-web/tmap/build.gradle.kts index c81bacc1..a262c7ea 100644 --- a/piikii-output-web/tmap/build.gradle.kts +++ b/piikii-output-web/tmap/build.gradle.kts @@ -4,5 +4,5 @@ plugins { dependencies { implementation(project(":piikii-application")) - implementation("org.springframework:spring-web") + implementation(libs.spring.web) } From e4b3b0431acde3f0fb2746dd7420ea0a148e2042 Mon Sep 17 00:00:00 2001 From: KimDoubleB Date: Wed, 18 Sep 2024 22:13:00 +0900 Subject: [PATCH 5/5] fix: annotationProcessor to implementation --- buildSrc/src/main/kotlin/piikii-convention.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/piikii-convention.gradle.kts b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts index 622c3f5c..d061fb53 100644 --- a/buildSrc/src/main/kotlin/piikii-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/piikii-convention.gradle.kts @@ -23,9 +23,9 @@ group = "com.piikii" version = "0.0.1-SNAPSHOT" dependencies { + implementation(libs.bundles.spring.common) + implementation(libs.bundles.kotlin.spring) annotationProcessor(libs.spring.boot.annotation.processor) - annotationProcessor(libs.bundles.spring.common) - annotationProcessor(libs.bundles.kotlin.spring) testImplementation(libs.bundles.test.implementation) testRuntimeOnly(libs.bundles.test.runtime) }