forked from greedy-team/mokkoji-be
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
178 lines (140 loc) · 5.2 KB
/
build.gradle
File metadata and controls
178 lines (140 loc) · 5.2 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.2'
id 'io.spring.dependency-management' version '1.1.7'
id 'jacoco'
}
group = 'com.greedy'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// database
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
//lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
//jwt
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
//redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
// HTTP 클라이언트 요청
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.9.3'
//openfeign
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
// HTML 파싱
implementation 'org.jsoup:jsoup:1.15.3'
// QueryDSL
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
// 메일 전송
implementation 'org.springframework.boot:spring-boot-starter-mail:3.4.2'
// AWS S3
implementation 'software.amazon.awssdk:bom:2.21.0'
implementation 'software.amazon.awssdk:s3:2.21.0'
// 테스트
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'
testImplementation 'org.mockito:mockito-core'
testImplementation 'io.rest-assured:rest-assured:5.1.1'
// 모니터링
implementation 'io.micrometer:micrometer-registry-prometheus'
//swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.3'
}
tasks.named('test') {
useJUnitPlatform()
}
//JaCoCo 플러그인 설정
jacoco {
toolVersion = '0.8.12'
reportsDirectory = layout.buildDirectory.dir("reports/jacoco")
}
// 테스트 실행 후 자동으로 코드 커버리지 보고서를 생성하려면 다음과 같이 설정할 수 있습니다.
test {
// test 실행 후 무조건 보고서 생성
// finalizedBy(jacocoTestReport)
}
jacocoTestReport {
// test가 실행된 후에만 보고서 생성
dependsOn(test)
// JaCoCo 보고서 구성
// XML 및 CSV 보고서는 생성되지 않고, HTML 보고서는 jacocoHtml 디렉터리에 저장
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
def Qdomains = []
for (qPattern in "**/QA".."**/QZ") {
Qdomains.add(qPattern + "*")
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [] + Qdomains)
}))
}
// jacocoTestReport후 실행
//finalizedBy(jacocoTestCoverageVerification)
}
jacocoTestCoverageVerification {
def Qdomains = []
for (qPattern in "*.QA".."*.QZ") { // qPattern = "*.QA","*.QB","*.QC", ... "*.QZ"
Qdomains.add(qPattern + "*")
}
violationRules {
rule {
element = 'CLASS'
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.60
}
excludes = [] + Qdomains
}
}
}
// test, jacocoTestReport jacocoTestCoverageVerification를 함께 진행하려고 만듬
// testCoverage라는 새로운 Gradle 태스크를 정의
task testCoverage(type: Test /*type: Test를 지정하여 이 태스크가 Test 타입의 태스크임*/) {
// 태스크를 verification 그룹에 포함시킴. (verification은 테스트 및 검증 관련 태스크들이 모이는 그룹임)
group 'verification'
description 'Runs the tests with coverage'
// testCoverage 태스크를 실행하면 :test, :jacocoTestReport, :jacocoTestCoverageVerification 태스크도 실행됨.
dependsOn(':test',
':jacocoTestReport',
':jacocoTestCoverageVerification')
// 실행 순서 지정
tasks['jacocoTestReport'].mustRunAfter(tasks['test'])
tasks['jacocoTestCoverageVerification'].mustRunAfter(tasks['jacocoTestReport'])
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2024.0.1" // Spring Boot 3.4.x 에 호환되는 버전
}
}