-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
200 lines (167 loc) · 5.73 KB
/
Copy pathbuild.gradle
File metadata and controls
200 lines (167 loc) · 5.73 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'jacoco'
id 'org.sonarqube' version '4.2.1.3168'
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'com.epages.restdocs-api-spec' version '0.19.2' // 1
}
group = 'com.github.can019'
version = '0.2.2'
java {
sourceCompatibility = '21'
}
jacoco {
toolVersion = "0.8.11"
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.2.5'
implementation 'org.springframework.boot:spring-boot-starter-web:3.2.5'
implementation 'org.springframework.boot:spring-boot-devtools:3.2.5'
implementation 'com.fasterxml.uuid:java-uuid-generator:5.0.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.2.5'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.2'
runtimeOnly 'com.h2database:h2:2.2.224'
runtimeOnly 'com.mysql:mysql-connector-j:8.3.0'
// aop
implementation 'org.springframework.boot:spring-boot-starter-aop:3.2.5'
// docker compose
testAndDevelopmentOnly 'org.springframework.boot:spring-boot-docker-compose:3.2.5'
// lombok
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
// Logback을 log4j2로 대체
implementation 'org.springframework.boot:spring-boot-starter-log4j2:3.2.5'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.4'
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
replacedBy("org.springframework.boot:spring-boot-starter-log4j2")
}
}
// actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator:3.2.5'
// rest assured
testImplementation 'io.rest-assured:rest-assured:5.3.2' // add rest-assured dependency
testImplementation 'org.springframework.restdocs:spring-restdocs-restassured:3.0.1'
testImplementation 'com.epages:restdocs-api-spec-restassured:0.19.2' // 3
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.19.2'
// test container
testImplementation 'org.testcontainers:junit-jupiter:1.19.7'
runtimeOnly 'com.mysql:mysql-connector-j:8.3.0'
testImplementation 'org.testcontainers:mysql:1.19.7'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
extendsFrom testAnnotationProcessor
}
integrationTestImplementation.extendsFrom implementation
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
unitTestImplementation.extendsFrom implementation
unitTestImplementation.extendsFrom testImplementation
unitTestRuntimeOnly.extendsFrom testRuntimeOnly
unitTestCompileOnly.extendsFrom testCompileOnly
unitTestAnnotationProcessor.extendsFrom testAnnotationProcessor
integrationTestCompileOnly.extendsFrom testCompileOnly
integrationTestAnnotationProcessor.extendsFrom testAnnotationProcessor
}
sourceSets {
integrationTest {
java.srcDir "$projectDir/src/integration/java"
resources.srcDir "$projectDir/src/integration/resources"
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
unitTest {
java.srcDir "$projectDir/src/unit/java"
resources.srcDir "$projectDir/src/unit/resources"
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
ext {
snippetsDir = file("build/generated-snippets")
}
tasks.withType(JacocoReport) {
reports {
html.required = true
xml.required = true
csv.required = false
}
}
tasks.withType(Test){
useJUnitPlatform()
}
task integrationTest(type: Test) {
description = 'Integration test' // 태스크 설명
group = 'test'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
jacoco {
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile
}
}
task unitTest(type: Test) {
description = 'Unit test' // 태스크 설명
group = 'test'
testClassesDirs = sourceSets.unitTest.output.classesDirs
classpath = sourceSets.unitTest.runtimeClasspath
jacoco {
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile
}
}
task unitTestJacocoReport(type: JacocoReport) {
executionData fileTree(dir: "$buildDir/jacoco/", include: "**/unitTest.exec")
sourceSets sourceSets.main
reports {
xml.destination file("$buildDir/reports/jacoco/unitTest/index.xml")
html.destination file("$buildDir/reports/jacoco/unitTest/html")
}
}
task integrationTestJacocoReport(type: JacocoReport) {
executionData fileTree(dir: "$buildDir/jacoco/", include: "**/integrationTest.exec")
sourceSets sourceSets.main
reports {
xml.destination file("$buildDir/reports/jacoco/integrationTest/index.xml")
html.destination file("$buildDir/reports/jacoco/integrationTest/html")
}
}
task overAllJacocoTestReport(type: JacocoReport) {
executionData fileTree(dir: "$buildDir/jacoco/", include: "**/*.exec")
sourceSets sourceSets.main
reports {
xml.destination file("$buildDir/reports/jacoco/total/index.xml")
html.destination file("$buildDir/reports/jacoco/total/html")
}
}
sonar {
properties {
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.organization', 'can019'
property 'sonar.projectKey', 'can019_spring-base'
property 'sonar.sources', 'src/main/java'
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/total/index.xml'
}
}
asciidoctor {
doFirst {
delete file("src/main/resources/static/docs")
}
sourceDir snippetsDir
}
openapi3 {
server = 'http://localhost:8080'
title = 'SPRING-BASE'
description = 'Spring base'
version = '0.2.2'
format = 'yaml'
}
check.dependsOn integrationTest
check.dependsOn unitTest