전체 서비스 빌드 설정 업데이트 및 kos-mock 데이터 동기화

This commit is contained in:
hiondal 2025-09-11 18:37:56 +09:00
parent fb0c5da973
commit 0f1e22c5dc
8 changed files with 41 additions and 287 deletions

View File

@ -44,52 +44,7 @@ dependencyManagement {
}
}
// ( )
tasks.named('test') {
systemProperty 'spring.profiles.active', 'test'
}
// JAR
jar {
archiveBaseName = 'api-gateway'
enabled = false
}
bootJar {
archiveFileName = 'api-gateway.jar'
//
manifest {
attributes(
'Implementation-Title': 'PhoneBill API Gateway',
'Implementation-Version': "${version}",
'Built-By': System.getProperty('user.name'),
'Built-JDK': System.getProperty('java.version'),
'Build-Time': new Date().format('yyyy-MM-dd HH:mm:ss')
)
}
}
//
if (project.hasProperty('dev')) {
bootRun {
systemProperty 'spring.profiles.active', 'dev'
jvmArgs = ['-Dspring.devtools.restart.enabled=true']
}
}
//
if (project.hasProperty('prod')) {
bootRun {
systemProperty 'spring.profiles.active', 'prod'
jvmArgs = [
'-server',
'-Xms512m',
'-Xmx1024m',
'-XX:+UseG1GC',
'-XX:G1HeapRegionSize=16m',
'-XX:+UseStringDeduplication',
'-XX:+OptimizeStringConcat'
]
}
}

View File

@ -1,10 +1,6 @@
// bill-service
// build.gradle의 subprojects
plugins {
id 'jacoco'
}
dependencies {
// Database (bill service specific)
runtimeOnly 'org.postgresql:postgresql'
@ -36,62 +32,7 @@ dependencies {
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.35.0'
}
tasks.named('test') {
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}
jacoco {
toolVersion = "0.8.8"
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.80
}
}
}
}
springBoot {
buildInfo()
}
//
task runDev(type: JavaExec, dependsOn: 'classes') {
group = 'application'
description = 'Run the application with dev profile'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'com.phonebill.bill.BillServiceApplication'
systemProperty 'spring.profiles.active', 'dev'
}
task runProd(type: JavaExec, dependsOn: 'classes') {
group = 'application'
description = 'Run the application with prod profile'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'com.phonebill.bill.BillServiceApplication'
systemProperty 'spring.profiles.active', 'prod'
}
// JAR
jar {
enabled = false
archiveBaseName = 'bill-service'
}
bootJar {
archiveFileName = 'bill-service.jar'
enabled = true
archiveClassifier = ''
}

View File

@ -3,6 +3,8 @@ plugins {
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'
@ -26,6 +28,13 @@ subprojects {
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)
@ -53,6 +62,36 @@ subprojects {
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)

View File

@ -1,12 +1,6 @@
// kos-mock
// build.gradle의 subprojects
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-web'
@ -41,17 +35,6 @@ dependencies {
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
}
tasks.named('test') {
useJUnitPlatform()
}
// JAR ( enabled = true)
jar {
archiveBaseName = 'kos-mock-service'
archiveVersion = version
enabled = true
}
bootJar {
archiveFileName = 'kos-mock.jar'
}

Binary file not shown.

View File

@ -82,5 +82,3 @@ springdoc:
operations-sorter: alpha
show-actuator: true
paths-to-exclude: /actuator/**
cors:
allowed-origins: "http://localhost:3000,http://phonebill.20.214.196.128.nip.io,http://phonebill-front.20.214.196.128.nip.io"

View File

@ -30,160 +30,8 @@ dependencies {
testImplementation 'io.github.resilience4j:resilience4j-test:2.1.0'
}
dependencyManagement {
imports {
mavenBom 'org.testcontainers:testcontainers-bom:1.19.1'
}
}
tasks.named('test') {
// Test
systemProperty 'spring.profiles.active', 'test'
//
maxParallelForks = Runtime.runtime.availableProcessors()
//
minHeapSize = "512m"
maxHeapSize = "2048m"
// Test
testLogging {
events "passed", "skipped", "failed"
exceptionFormat = 'full'
}
// Coverage
finalizedBy jacocoTestReport
}
// Jacoco Test Coverage
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.10"
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
csv.required = false
html.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/dto/**',
'**/config/**',
'**/exception/**',
'**/*Application.*'
])
}))
}
}
jacocoTestCoverageVerification {
dependsOn jacocoTestReport
violationRules {
rule {
limit {
minimum = 0.80 // 80%
}
}
}
}
// Spring Boot Plugin
springBoot {
buildInfo()
}
// JAR
jar {
enabled = false
archiveClassifier = ''
}
bootJar {
enabled = true
archiveClassifier = ''
archiveFileName = "${project.name}.jar"
// Build
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'MVNO Corp',
'Built-By': System.getProperty('user.name'),
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ"),
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Build-Jdk': "${System.getProperty('java.version')}",
'Build-OS': "${System.getProperty('os.name')} ${System.getProperty('os.arch')} ${System.getProperty('os.version')}"
)
}
}
//
if (project.hasProperty('dev')) {
bootRun {
args = ['--spring.profiles.active=dev']
systemProperty 'spring.devtools.restart.enabled', 'true'
systemProperty 'spring.devtools.livereload.enabled', 'true'
}
}
// Production
if (project.hasProperty('prod')) {
bootJar {
archiveFileName = "${project.name}-${project.version}-prod.jar"
}
}
// Docker
task copyJar(type: Copy, dependsOn: bootJar) {
from layout.buildDirectory.file("libs/${bootJar.archiveFileName.get()}")
into layout.buildDirectory.dir("docker")
rename { String fileName ->
fileName.replace(bootJar.archiveFileName.get(), "app.jar")
}
}
// ( )
task checkstyle(type: Checkstyle) {
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
source 'src/main/java'
include '**/*.java'
exclude '**/generated/**'
classpath = files()
ignoreFailures = true
}
// Clean
clean {
delete 'logs'
delete 'build/docker'
}
//
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-processing',
'-Werror'
]
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-processing'
]
archiveFileName = "product-service.jar"
}

View File

@ -26,16 +26,6 @@ dependencies {
// ( )
// JAR
jar {
archiveBaseName = 'user-service'
enabled = false
}
bootJar {
archiveFileName = 'user-service.jar'
}
// Spring Boot
springBoot {
mainClass = 'com.phonebill.user.UserServiceApplication'
}