-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
125 lines (110 loc) · 3.6 KB
/
build.gradle
File metadata and controls
125 lines (110 loc) · 3.6 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.3'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.hibernate.orm' version '6.4.4.Final'
id 'jacoco'
}
hibernate {
enhancement {
enableLazyInitialization = true
enableDirtyTracking = true
enableAssociationManagement = true
}
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.auth0:java-jwt:3.3.0'
// implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.3'
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation "com.fasterxml.jackson.core:jackson-databind"
implementation 'org.springframework.boot:spring-boot-starter-cache' // @Cacheable 등
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'io.micrometer:micrometer-registry-prometheus'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation "org.testcontainers:junit-jupiter"
testImplementation "org.testcontainers:postgresql"
implementation 'org.springframework.boot:spring-boot-starter-websocket' //websokect
implementation 'org.springframework.security:spring-security-messaging' //권한검증등
}
jacoco {
toolVersion = "0.8.12"
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy tasks.jacocoTestReport // 리포트는 테스트 후
}
tasks.jacocoTestReport {
dependsOn tasks.test
reports{
xml.required.set(true)
html.required.set(true)
}
}
/** ③ 커버리지 게이트(70%) — 전체 번들 기준(필요 시 클래스/패키지 룰 추가 가능) */
tasks.jacocoTestCoverageVerification {
dependsOn tasks.test
violationRules {
// rule {
// element = 'BUNDLE'
// limit {
// counter = 'INSTRUCTION'
// value = 'COVEREDRATIO'
// minimum = 0.70
// }
// }
// 예) 특정 컨트롤러도 강제하려면 FQN 정확히:
rule {
element = 'CLASS'
includes = ['com.example.trader.service.UserService']
limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 0.50
}
}
}
}
tasks.named('check') {
dependsOn 'jacocoTestCoverageVerification'
}
tasks.register('printTestClasses') {
dependsOn tasks.named('testClasses')
doLast {
def tree = sourceSets.test.output.classesDirs.asFileTree.matching { include '**/*.class' }
println "== Compiled test classes =="
tree.files.each { println it }
}
}
/** (보험) build가 check를 반드시 타도록 — 기본이긴 하지만 명시해둬도 무방 */
tasks.named('build') {
dependsOn 'check'
}
check.dependsOn jacocoTestCoverageVerification // ✅ 빌드/체크 시 커버리지 게이트 적용