phonebill/build.gradle
2025-09-13 19:55:46 +09:00

170 lines
5.9 KiB
Groovy

plugins {
id 'java'
id 'org.springframework.boot' version '3.3.0' apply false
id 'io.spring.dependency-management' version '1.1.6' apply false
id 'io.freefair.lombok' version '8.10' apply false
id "org.sonarqube" version "5.0.0.4638" apply false
}
group = 'com.unicorn.phonebill'
version = '1.0.0'
allprojects {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'io.freefair.lombok'
if (it.name == 'common') {
apply plugin: 'io.spring.dependency-management'
} else {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
}
apply plugin: 'org.sonarqube'
apply plugin: 'jacoco' // 서브 프로젝트에 JaCoCo 플러그인 적용
jacoco {
toolVersion = "0.8.11" // JaCoCo 최신 버전 사용
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
tasks.named('test') {
useJUnitPlatform()
}
// Common versions for all subprojects
ext {
jjwtVersion = '0.12.5'
springdocVersion = '2.5.0'
mapstructVersion = '1.5.5.Final'
commonsLang3Version = '3.14.0'
commonsIoVersion = '2.16.1'
hypersistenceVersion = '3.7.3'
openaiVersion = '0.18.2'
feignJacksonVersion = '13.1'
}
test {
useJUnitPlatform()
include '**/*Test.class'
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport // 테스트 후 JaCoCo 리포트 생성
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true // SonarQube 분석을 위해 XML 형식 필요
csv.required = false
html.required = true
html.outputLocation = layout.buildDirectory.dir("jacocoHtml").get().asFile
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/config/**", // 설정 클래스 제외
"**/entity/**", // 엔티티 클래스 제외
"**/dto/**", // DTO 클래스 제외
"**/*Application.class", // 메인 애플리케이션 클래스 제외
"**/exception/**" // 예외 클래스 제외
])
}))
}
}
}
// Configure only service modules (exclude common and api-gateway)
configure(subprojects.findAll { it.name != 'common' && it.name != 'api-gateway' }) {
dependencies {
// Common Spring Boot Starters
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-cache'
// Actuator for health checks and monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// JWT Authentication (common across all services)
implementation "io.jsonwebtoken:jjwt-api:${jjwtVersion}"
runtimeOnly "io.jsonwebtoken:jjwt-impl:${jjwtVersion}"
runtimeOnly "io.jsonwebtoken:jjwt-jackson:${jjwtVersion}"
// JSON Processing
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
// API Documentation (common across all services)
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocVersion}"
// Common Utilities
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
// Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.awaitility:awaitility:4.2.0'
// Configuration Processor
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
}
}
// Configure API Gateway separately (uses WebFlux instead of Web)
configure(subprojects.findAll { it.name == 'api-gateway' }) {
dependencies {
// WebFlux instead of Web for reactive programming
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
implementation 'org.springframework.boot:spring-boot-starter-validation'
// Actuator for health checks and monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// JWT Authentication (same as other services)
implementation "io.jsonwebtoken:jjwt-api:${jjwtVersion}"
implementation "io.jsonwebtoken:jjwt-impl:${jjwtVersion}"
implementation "io.jsonwebtoken:jjwt-jackson:${jjwtVersion}"
// Testing (WebFlux specific)
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'io.projectreactor:reactor-test'
// Configuration Processor
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
}
}