-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
179 lines (154 loc) · 4.32 KB
/
build.gradle
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
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
id 'jacoco'
id 'org.sonarqube' version '6.0.1.5171'
id 'com.epages.restdocs-api-spec' version '0.19.4'
id 'org.hidetake.swagger.generator' version '2.18.2'
}
group = 'co.yapp.orbit'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
// Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// Database
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
// WebClient
implementation 'org.springframework.boot:spring-boot-starter-webflux'
// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.19.4'
// Health Check
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}
tasks.named('build') {
dependsOn 'copyOasToSwagger'
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}
tasks.register("copyOasToSwagger", Copy) {
dependsOn 'openapi3'
doFirst {
delete('src/main/resources/static/docs/openapi3.json')
}
from(layout.buildDirectory.file("api-spec/openapi3.json"))
into('src/main/resources/static/docs/')
}
openapi3 {
servers = [
{
url = "https://dev.orbitalarm.net"
description = "Dev Server"
},
{
url = "http://localhost:8080"
description = "Local Server"
}
]
title = "Orbit API"
description = "오르비 백엔드 API 명세서입니다."
version = "1.0.0"
format = "json"
}
jacoco {
toolVersion = '0.8.10'
}
sonar {
properties {
property "sonar.projectKey", "YAPP-Github_25th-App-Team-1-BE"
property "sonar.organization", "yapp-github"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.sources', 'src'
property 'sonar.language', 'java'
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.test.exclusions', '**/*Application*.java, **/*Controller*.java, **/config/**, **/dto/**, **/exception/**'
property 'sonar.test.inclusions', '**/*Test.java'
property 'sonar.java.coveragePlugin', 'jacoco'
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/index.xml'
}
}
jacocoTestReport {
dependsOn test // test 종속성 추가
reports {
html.required.set(true)
xml.required.set(true)
csv.required.set(true)
html.outputLocation.set(file(layout.buildDirectory.dir("reports/jacoco/index.html").get().asFile))
xml.outputLocation.set(file(layout.buildDirectory.dir("reports/jacoco/index.xml").get().asFile))
csv.outputLocation.set(file(layout.buildDirectory.dir("reports/jacoco/index.csv").get().asFile))
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, excludes: [
'**/*Application*',
'**/*Controller*',
'**/config/*',
'**/*Config*',
'**/request/*',
'**/*Request*',
'**/response/*',
'**/*Response*',
'**/exception/*',
'**/*Exception*'
])
}))
}
finalizedBy 'jacocoTestCoverageVerification'
}
jacocoTestCoverageVerification {
violationRules {
rule {
failOnViolation = false // TODO: 테스트 코드 추가 시 제거 (jacoco 세팅용)
enabled = true
element = 'CLASS'
limit {
counter = 'LINE' // 라인 커버리지 기준
value = 'COVEREDRATIO'
minimum = 0.50 // 최소 50% 이상 커버리지 필요
}
limit {
counter = 'BRANCH' // 분기 커버리지 기준
value = 'COVEREDRATIO'
minimum = 0.50 // 최소 50% 이상 커버리지 필요
}
excludes = [
'**.*Application*',
'**.*Controller*',
'**.config.*',
'**.request.*',
'**.response.*',
'**.exception.*',
'**.*Config*',
'**.*Request*',
'**.*Response*',
'**.*Exception*'
]
}
}
}