diff --git a/build.gradle.kts b/build.gradle.kts index 1acc9fc..71fee99 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,94 +1,53 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.springframework.boot.gradle.tasks.bundling.BootJar plugins { id("org.springframework.boot") version "3.2.3" id("io.spring.dependency-management") version "1.1.4" kotlin("jvm") version "1.9.22" kotlin("plugin.spring") version "1.9.22" - kotlin("plugin.jpa") version "1.9.22" } -group = "com.KY" -version = "0.0.1-SNAPSHOT" +val jar: Jar by tasks +val bootJar: BootJar by tasks -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} +bootJar.enabled = false +jar.enabled = true -configurations { - compileOnly { - extendsFrom(configurations.annotationProcessor.get()) +allprojects{ + group = "com.van1164" + version = "0.0.1-SNAPSHOT" + repositories { + mavenCentral() } } -repositories { - mavenCentral() -} - -dependencies { - implementation("org.springframework.boot:spring-boot-starter-batch") - implementation("org.springframework.boot:spring-boot-starter-data-jdbc") - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive") - implementation("org.springframework.boot:spring-boot-starter-oauth2-authorization-server") - - implementation("org.springframework.boot:spring-boot-starter-security") - - implementation("org.springframework.boot:spring-boot-starter-webflux") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("io.projectreactor.kotlin:reactor-kotlin-extensions") - implementation("org.apache.kafka:kafka-streams") - implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") - implementation("com.amazonaws:aws-java-sdk-s3:1.12.638") - implementation("net.bramp.ffmpeg:ffmpeg:0.8.0") - implementation("org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3") - - compileOnly("org.projectlombok:lombok") - runtimeOnly("com.mysql:mysql-connector-j") - annotationProcessor("org.projectlombok:lombok") - testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("io.projectreactor:reactor-test") - testImplementation("org.springframework.batch:spring-batch-test") - testImplementation("org.springframework.security:spring-security-test") - implementation("io.github.microutils:kotlin-logging:1.12.0") - - //oAuth2 - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - - //jwt - implementation("io.jsonwebtoken:jjwt-api:0.11.5") - runtimeOnly("io.jsonwebtoken:jjwt-impl:0.11.5") - runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.11.5") - - implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") - implementation("com.github.jasync-sql:jasync-r2dbc-mysql:2.2.0") - - testImplementation("io.projectreactor:reactor-test:3.6.5") - - // kotest - testImplementation("io.kotest:kotest-runner-junit5:5.4.2") - testImplementation("io.kotest:kotest-assertions-core:5.4.2") - testImplementation("io.kotest.extensions:kotest-extensions-spring:1.1.2") - - // mockk - testImplementation("io.mockk:mockk:1.13.8") - -} - subprojects { - group = "com.KY" - version = "0.0.1-SNAPSHOT" - - - apply(plugin = "org.springframework.boot") - apply(plugin = "io.spring.dependency-management") - apply(plugin = "org.jetbrains.kotlin.jvm") - apply(plugin = "org.jetbrains.kotlin.plugin.spring") - apply(plugin = "org.jetbrains.kotlin.plugin.jpa") - + apply { + plugin("org.springframework.boot") + plugin("io.spring.dependency-management") + plugin("org.jetbrains.kotlin.plugin.spring") + plugin("org.jetbrains.kotlin.jvm") + plugin("kotlin") + plugin("kotlin-kapt") + } +// apply(plugin = "org.springframework.boot") +// apply(plugin = "io.spring.dependency-management") +// apply(plugin = "org.jetbrains.kotlin.plugin.spring") +// apply(plugin = "org.jetbrains.kotlin.plugin.jpa") +// apply(plugin = "kotlin") +// apply(plugin = "kotlin-kapt") + + +// configurations { +// compileOnly { +// extendsFrom(configurations.annotationProcessor.get()) +// } +// } + java.sourceCompatibility = JavaVersion.VERSION_17 + java.targetCompatibility = JavaVersion.VERSION_17 dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") @@ -97,7 +56,7 @@ subprojects { compileOnly("org.projectlombok:lombok") runtimeOnly("com.mysql:mysql-connector-j") annotationProcessor("org.projectlombok:lombok") - testImplementation("org.springframework.boot:spring-boot-starter-test") + testImplementation("io.projectreactor:reactor-test") implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") implementation("com.github.jasync-sql:jasync-r2dbc-mysql:2.2.0") @@ -120,36 +79,25 @@ subprojects { implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.5.0") implementation("org.springdoc:springdoc-openapi-starter-webflux-api:2.5.0") - // - } - - configurations { - compileOnly { - extendsFrom(configurations.annotationProcessor.get()) + testImplementation("org.springframework.boot:spring-boot-starter-test") { + exclude(group = "org.junit.vintage", module = "junit-vintage-engine") } - } - java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + testImplementation("org.junit.jupiter:junit-jupiter-api") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") + } tasks.withType { kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" + freeCompilerArgs += "-Xjsr305=strict -Dfile.encoding=UTF-8" jvmTarget = "17" } } -} - -tasks.withType { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - jvmTarget = "17" + tasks.withType { + systemProperty("file.encoding","UTF-8") + useJUnitPlatform() } -} -tasks.withType { - useJUnitPlatform() } diff --git a/comment/build.gradle.kts b/comment/build.gradle.kts index e17b2e3..0af3446 100644 --- a/comment/build.gradle.kts +++ b/comment/build.gradle.kts @@ -1,11 +1,5 @@ import org.springframework.boot.gradle.tasks.bundling.BootJar -plugins { - kotlin("jvm") version "1.9.22" -} - -group = "com.van1164" -version = "0.0.1-SNAPSHOT" repositories { mavenCentral() @@ -15,13 +9,15 @@ val bootJar: BootJar by tasks bootJar.enabled = false jar.enabled = true + dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test") implementation(project(":util")) implementation(project(":user")) implementation(project(":security")) - implementation(project(":main")) + implementation(project(":main_module")) } -tasks.test { +tasks.withType { useJUnitPlatform() } diff --git a/gradle.properties b/gradle.properties index e69de29..7711b30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -0,0 +1,7 @@ +### Project dependency versions ### +kotlinVersion=1.9.22 +javaVersion=21 + +### Spring dependency versions ### +springBootVersion=3.2.3 +springDependencyManagementVersion=1.1.4 diff --git a/live_stream/build.gradle.kts b/live_stream/build.gradle.kts index 8fbf039..8c6002e 100644 --- a/live_stream/build.gradle.kts +++ b/live_stream/build.gradle.kts @@ -1,10 +1,10 @@ -plugins { - kotlin("jvm") -} +import org.springframework.boot.gradle.tasks.bundling.BootJar -group = "com.van1164" -version = "0.0.1-SNAPSHOT" +val jar: Jar by tasks +val bootJar: BootJar by tasks +bootJar.enabled = false +jar.enabled = true repositories { mavenCentral() } @@ -15,7 +15,4 @@ dependencies { tasks.test { useJUnitPlatform() -} -kotlin { - jvmToolchain(20) } \ No newline at end of file diff --git a/main_module/build.gradle.kts b/main_module/build.gradle.kts new file mode 100644 index 0000000..9bb9ef6 --- /dev/null +++ b/main_module/build.gradle.kts @@ -0,0 +1,21 @@ +import org.springframework.boot.gradle.tasks.bundling.BootJar + +val jar: Jar by tasks +val bootJar: BootJar by tasks + +bootJar.enabled = false +jar.enabled = true +repositories { + mavenCentral() +} + +dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test") + implementation(project(":util")) + implementation(project(":security")) + implementation(project(":user")) +} + +tasks.test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/main_module/src/main/kotlin/com/van1164/main_module/MainController.kt b/main_module/src/main/kotlin/com/van1164/main_module/MainController.kt index 5a10c66..455a3d2 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/MainController.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/MainController.kt @@ -1,4 +1,4 @@ -package com.van1164.main +package com.van1164.main_module import com.van1164.common.util.Utils.logger import com.van1164.security.JwtTokenProvider diff --git a/main_module/src/main/kotlin/com/van1164/main_module/MainRepository.kt b/main_module/src/main/kotlin/com/van1164/main_module/MainRepository.kt index 40c76c0..addaa1f 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/MainRepository.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/MainRepository.kt @@ -1,4 +1,4 @@ -package com.van1164.main +package com.van1164.main_module import org.springframework.stereotype.Repository diff --git a/main_module/src/main/kotlin/com/van1164/main_module/MainRestController.kt b/main_module/src/main/kotlin/com/van1164/main_module/MainRestController.kt index a0bc847..c9f6739 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/MainRestController.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/MainRestController.kt @@ -1,11 +1,11 @@ -package com.van1164.main +package com.van1164.main_module import com.van1164.common.response.MainResponse import com.van1164.common.util.Utils.logger +import com.van1164.main_module.MainService import org.springframework.http.HttpHeaders import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity -import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam diff --git a/main_module/src/main/kotlin/com/van1164/main_module/MainService.kt b/main_module/src/main/kotlin/com/van1164/main_module/MainService.kt index ba01a9f..71a7b44 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/MainService.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/MainService.kt @@ -1,8 +1,8 @@ -package com.van1164.main +package com.van1164.main_module import com.van1164.common.response.MainResponse -import com.van1164.main.live.LiveReadService +import com.van1164.main_module.live.LiveReadService import com.van1164.main.video.VideoReadService import org.springframework.stereotype.Service import reactor.core.publisher.Mono diff --git a/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadRepository.kt b/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadRepository.kt index 2c512d2..8b8ff90 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadRepository.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadRepository.kt @@ -1,4 +1,4 @@ -package com.van1164.main.live +package com.van1164.main_module.live import com.van1164.common.domain.LiveStream import org.springframework.data.r2dbc.repository.R2dbcRepository diff --git a/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadService.kt b/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadService.kt index bcc2f98..5ecfdca 100644 --- a/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadService.kt +++ b/main_module/src/main/kotlin/com/van1164/main_module/live/LiveReadService.kt @@ -1,6 +1,7 @@ -package com.van1164.main.live +package com.van1164.main_module.live import com.van1164.common.domain.LiveStream +import com.van1164.main_module.live.LiveReadRepository import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories import org.springframework.stereotype.Service import reactor.core.publisher.Flux diff --git a/main_module/src/main/resources/application.properties b/main_module/src/main/resources/application.properties new file mode 100644 index 0000000..aa0599a --- /dev/null +++ b/main_module/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=main_module diff --git a/security/build.gradle.kts b/security/build.gradle.kts index 6326e5c..4123d3c 100644 --- a/security/build.gradle.kts +++ b/security/build.gradle.kts @@ -33,9 +33,6 @@ dependencies { implementation(project(":user")) } -tasks.test { +tasks.withType { useJUnitPlatform() } -kotlin { - jvmToolchain(20) -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 7f26554..db83352 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,11 +1,27 @@ -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" -} rootProject.name = "KoreanYoutube" include("video") include("user") include("security") include("live_stream") include("util") -include("main") -include("comment") \ No newline at end of file +include("comment") +include("main_module") + +pluginManagement { + val kotlinVersion: String by settings + val springBootVersion: String by settings + val springDependencyManagementVersion: String by settings + + resolutionStrategy { + eachPlugin { + when (requested.id.id) { + "org.jetbrains.kotlin.jvm" -> useVersion(kotlinVersion) + "org.jetbrains.kotlin.plugin.spring" -> useVersion(kotlinVersion) + "org.jetbrains.kotlin.plugin.jpa" -> useVersion(kotlinVersion) + "org.jetbrains.kotlin.kapt" -> useVersion(kotlinVersion) + "org.springframework.boot" -> useVersion(springBootVersion) + "io.spring.dependency-management" -> useVersion(springDependencyManagementVersion) + } + } + } +} \ No newline at end of file diff --git a/user/build.gradle.kts b/user/build.gradle.kts index a354ae6..a60a688 100644 --- a/user/build.gradle.kts +++ b/user/build.gradle.kts @@ -22,10 +22,6 @@ dependencies { implementation(project(":util")) } -tasks.test { +tasks.withType { useJUnitPlatform() } -kotlin { - jvmToolchain(20) -} -tasks.register("prepareKotlinBuildScriptModel") \ No newline at end of file diff --git a/util/build.gradle.kts b/util/build.gradle.kts index 437c419..8b602dc 100644 --- a/util/build.gradle.kts +++ b/util/build.gradle.kts @@ -1,8 +1,5 @@ import org.springframework.boot.gradle.tasks.bundling.BootJar -plugins { - kotlin("jvm") -} group = "com.van1164" version = "0.0.1-SNAPSHOT" @@ -27,6 +24,3 @@ dependencies { tasks.test { useJUnitPlatform() } -kotlin { - jvmToolchain(20) -} diff --git a/video/build.gradle.kts b/video/build.gradle.kts index e24f791..32402e3 100644 --- a/video/build.gradle.kts +++ b/video/build.gradle.kts @@ -1,9 +1,3 @@ -plugins { - kotlin("jvm") version "1.9.22" -} - -group = "com.van1164" -version = "0.0.1-SNAPSHOT" repositories { mavenCentral() @@ -13,10 +7,11 @@ dependencies { implementation(project(":util")) implementation(project(":user")) implementation(project(":security")) - implementation(project(":main")) + implementation(project(":main_module")) implementation(project(":comment")) + } -tasks.test { +tasks.withType { useJUnitPlatform() -} +} \ No newline at end of file