-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
370 lines (310 loc) · 12.1 KB
/
build.gradle
File metadata and controls
370 lines (310 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
plugins {
id 'java'
id 'war'
id 'com.diffplug.spotless' version '6.25.0'
id 'jacoco'
}
group 'org.scoula'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
ext {
junitVersion = '5.10.3'
springVersion = '5.3.39'
springBatchVersion = '4.3.10'
springSecurityVersion = '5.8.15'
lombokVersion = '1.18.34'
log4jVersion = '2.24.1'
jacksonVersion = '2.18.1'
mybatisVersion = '3.5.16'
mybatisSpringVersion = '2.1.2'
nettyVersion = '4.1.115.Final'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
dependencies {
// 스프링
implementation ("org.springframework:spring-context:${springVersion}")
{ exclude group: 'commons-logging', module: 'commons-logging' }
implementation "org.springframework:spring-webmvc:${springVersion}"
implementation "org.springframework:spring-tx:${springVersion}"
implementation "org.springframework:spring-jdbc:${springVersion}"
implementation 'javax.inject:javax.inject:1'
// Spring Security
implementation "org.springframework.security:spring-security-core:${springSecurityVersion}"
implementation "org.springframework.security:spring-security-web:${springSecurityVersion}"
implementation "org.springframework.security:spring-security-config:${springSecurityVersion}"
// JWT 처리 (카카오 토큰 검증용)
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
implementation 'io.jsonwebtoken:jjwt-impl:0.12.6'
implementation 'io.jsonwebtoken:jjwt-jackson:0.12.6'
// AOP
implementation 'org.aspectj:aspectjrt:1.9.22.1'
implementation 'org.aspectj:aspectjweaver:1.9.22.1'
// JSP, SERVLET, JSTL
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
compileOnly 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.3'
implementation 'javax.servlet:jstl:1.2'
// Validation
implementation 'javax.validation:validation-api:2.0.1.Final'
implementation 'org.hibernate.validator:hibernate-validator:6.2.5.Final'
// Spring Data (for pagination utilities)
implementation "org.springframework.data:spring-data-commons:2.7.18"
// Redis
implementation "org.springframework.data:spring-data-redis:2.7.18"
implementation "redis.clients:jedis:3.9.0"
// MongoDB
implementation "org.springframework.data:spring-data-mongodb:3.4.18"
implementation "org.mongodb:mongodb-driver-sync:4.6.1"
// Logging
implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
implementation "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
// SQL 로깅을 위한 log4jdbc-log4j2
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
// DB
implementation 'com.mysql:mysql-connector-j:8.4.0'
implementation 'com.zaxxer:HikariCP:5.1.0'
// MyBatis
implementation "org.mybatis:mybatis:${mybatisVersion}"
implementation "org.mybatis:mybatis-spring:${mybatisSpringVersion}"
// Spring Kafka (Apache Kafka 클라이언트 포함)
implementation "org.springframework.kafka:spring-kafka:2.9.13"
// Spring Batch
implementation "org.springframework.batch:spring-batch-core:${springBatchVersion}"
implementation "org.springframework.batch:spring-batch-infrastructure:${springBatchVersion}"
// WebSocket & STOMP
implementation "org.springframework:spring-websocket:${springVersion}"
implementation "org.springframework:spring-messaging:${springVersion}"
// Netty (비동기 네트워킹)
implementation "io.netty:netty-all:${nettyVersion}"
// Mail (SMTP)
implementation "org.springframework:spring-context-support:${springVersion}"
implementation 'javax.mail:javax.mail-api:1.6.2'
implementation 'com.sun.mail:javax.mail:1.6.2'
// SpringFox Swagger
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
// RestTemplate
implementation 'org.apache.httpcomponents:httpcore:4.4.16'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
// xml내 한글 처리
implementation 'xerces:xercesImpl:2.12.2'
// Lombok
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
// Jackson - Json 처리
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"
// AWS SDK v2
implementation 'software.amazon.awssdk:s3:2.28.25'
implementation 'software.amazon.awssdk:auth:2.28.25'
// 테스트
testImplementation "org.springframework:spring-test:${springVersion}"
testImplementation "org.springframework.batch:spring-batch-test:${springBatchVersion}"
testImplementation "org.springframework.kafka:spring-kafka-test:2.9.13"
testImplementation "org.springframework.security:spring-security-test:${springSecurityVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
// Mockito for testing
testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.12.0'
// AssertJ for fluent assertions
testImplementation 'org.assertj:assertj-core:3.25.3'
// JsonPath for MockMvc tests
testImplementation 'com.jayway.jsonpath:json-path:2.9.0'
testImplementation 'com.jayway.jsonpath:json-path-assert:2.9.0'
// Servlet API for testing
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
implementation 'javax.annotation:javax.annotation-api:1.3.2'
// s3
implementation 'software.amazon.awssdk:s3'
implementation 'software.amazon.awssdk:auth'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
//FireBase 설정 추가
implementation 'com.google.firebase:firebase-admin:9.2.0'
// PDF 처리 - iText
implementation 'com.itextpdf:itext7-core:7.2.5'
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport // 테스트 후 리포트 생성
ignoreFailures = true // 테스트 실패해도 JaCoCo 리포트 생성
// 테스트 실행 정보 출력
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = false
// 테스트 완료 후 요약 정보 출력
afterSuite { desc, result ->
if (!desc.parent) { // 최상위 스위트(전체 테스트)일 때만 출력
println "\n테스트 결과 요약:"
println "총 ${result.testCount}개 테스트 실행"
println "성공: ${result.successfulTestCount}개"
println "실패: ${result.failedTestCount}개"
println "건너뜀: ${result.skippedTestCount}개"
println "결과: ${result.resultType}"
}
}
}
}
// JaCoCo 테스트 리포트 설정
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = false
}
// 커버리지 제외 패턴
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/config/**',
'**/dto/**',
'**/entity/**',
'**/vo/**',
'**/exception/**',
'**/*Application.class',
'**/*Config.class',
'**/*Configuration.class',
'**/*Exception.class',
'**/*Dto.class',
'**/*DTO.class',
'**/*Vo.class',
'**/*VO.class',
'**/*Entity.class',
'**/*Mapper.class',
'**/*Request.class',
'**/*Response.class',
'**/*ErrorCode.class',
'**/*Constant*.class',
'**/*Enum.class',
'**/enums/**'
])
}))
}
}
// JaCoCo 커버리지 검증
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.20 // 20% 라인 커버리지
}
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.10 // 10% 브랜치 커버리지
}
}
}
// 커버리지 검증 제외 패턴
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/config/**',
'**/dto/**',
'**/entity/**',
'**/vo/**',
'**/exception/**',
'**/*Application.class',
'**/*Config.class',
'**/*Configuration.class',
'**/*Exception.class',
'**/*Dto.class',
'**/*DTO.class',
'**/*Vo.class',
'**/*VO.class',
'**/*Entity.class',
'**/*Mapper.class',
'**/*Request.class',
'**/*Response.class',
'**/*ErrorCode.class',
'**/*Constant*.class',
'**/*Enum.class',
'**/enums/**'
])
}))
}
}
// check 태스크가 jacocoTestCoverageVerification을 실행하도록 설정
check {
dependsOn jacocoTestCoverageVerification
}
tasks.named('compileJava') {
dependsOn 'spotlessApply'
}
tasks.named('compileTestJava') {
dependsOn 'spotlessApply'
}
spotless {
java {
googleJavaFormat().aosp().reflowLongStrings()
importOrder('java', 'javax', 'jakarta', 'org', 'com')
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
// 4칸 들여쓰기를 위한 커스텀 포맷팅
custom 'indent', {
it.replaceAll(/(?m)^( {2})/, ' ') // 2칸을 4칸으로 변경
}
}
}
// Git submodule에서 properties 파일 복사
tasks.register('copyProperties') {
description = 'Copy properties files from git submodule'
doFirst {
def submoduleDir = file("${project.rootDir}/config-submodule")
def targetDir = file("${project.rootDir}/src/main/resources")
if (!submoduleDir.exists()) {
println "WARNING: Config submodule directory not found at ${submoduleDir.absolutePath}"
println "Please run: git submodule update --init --recursive"
return
}
// 복사할 properties 파일 목록
def propertyFiles = [
'application.properties',
'application-default.properties',
'application-dev.properties',
'application-prod.properties',
'application-secret.properties',
'log4jdbc.log4j2.properties',
'firebase-service-account.json',
]
propertyFiles.each { fileName ->
def sourceFile = file("${submoduleDir}/${fileName}")
if (sourceFile.exists()) {
copy {
from sourceFile
into targetDir
}
println "Copied: ${fileName}"
} else {
println "WARNING: ${fileName} not found in submodule"
}
}
}
}
// WAR 빌드 시 properties 복사
war {
dependsOn copyProperties
}
// processResources 시 properties 복사
processResources {
dependsOn copyProperties
}
// 빌드 시 자동으로 spotless 적용
gradle.projectsEvaluated {
tasks.withType(JavaCompile).configureEach {
dependsOn 'spotlessApply'
}
}