-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
146 lines (123 loc) · 4.16 KB
/
build.gradle
File metadata and controls
146 lines (123 loc) · 4.16 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.0'
id 'io.spring.dependency-management' version '1.1.7'
id "org.sonarqube" version "7.2.2.6593"
id 'jacoco'
}
group = 'zim.tave'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
sonar {
properties {
property "sonar.projectKey", "VoyaMeStudio_Me-mory_backend"
property "sonar.organization", "voyamestudio"
property "sonar.host.url", "https://sonarcloud.io"
// 소스 및 테스트 경로
property "sonar.sources", "src/main/java"
property "sonar.tests", "src/test/java"
property "sonar.java.binaries", "build/classes"
property "sonar.java.test.binaries", "build/classes"
// 제외할 경로
property "sonar.exclusions", """
**/build/**,
**/bin/**,
**/*Application.java,
**/config/**,
**/dto/**,
**/domain/**,
**/global/common/exception/**
"""
// 테스트 제외 경로 (선택적)
property "sonar.test.exclusions", "**/*Test.java"
// Java 버전
property "sonar.java.source", "21"
property "sonar.java.target", "21"
property "sonar.sourceEncoding", "UTF-8"
// Unit 테스트 커버리지 리포트 경로 (unitTest용)
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/unitTest/jacocoUnitTestReport.xml"
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'software.amazon.awssdk:s3:2.20.89'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
annotationProcessor 'org.projectlombok:lombok'
//testImplementation 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation platform('org.testcontainers:testcontainers-bom:1.19.8')
testImplementation 'org.testcontainers:testcontainers:1.19.8'
testImplementation 'org.testcontainers:mysql:1.19.8'
testImplementation 'org.testcontainers:junit-jupiter:1.19.8'
}
//로컬에서 사용하는 전체 테스트 실행행
tasks.named('test') {
useJUnitPlatform()
enabled = true
// 테스트 실행 과정을 콘솔에 출력하기 위한 설정 (실무 권장)
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat = "full"
}
}
// 통합 테스트 제외하고 실행하는 태스크 (CI에서 사용)
tasks.register('unitTest', Test) {
useJUnitPlatform {
excludeTags 'integration'
}
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat = "full"
}
finalizedBy jacocoUnitTestReport
}
// Unit 테스트용 JaCoCo 리포트 생성
tasks.register('jacocoUnitTestReport', JacocoReport) {
dependsOn unitTest
reports {
xml.required = true
xml.outputLocation = file("build/reports/jacoco/unitTest/jacocoUnitTestReport.xml")
html.required = true
html.outputLocation = file("build/reports/jacoco/unitTest/html")
}
executionData unitTest
sourceDirectories.from(files("src/main/java"))
classDirectories.from(files("build/classes/java/main"))
}
// integrationTest 테스트만 실행하는 태스크 (선택적 사용)
tasks.register('integrationTest', Test) {
useJUnitPlatform {
includeTags 'integration'
}
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat = "full"
}
}