-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
202 lines (163 loc) · 6.64 KB
/
build.gradle
File metadata and controls
202 lines (163 loc) · 6.64 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
201
202
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.4'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'com.diffplug.spotless' version '7.0.2'
}
group = 'com'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
asciidoctorExt
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.mapstruct:mapstruct:1.6.3'
implementation 'org.springframework.boot:spring-boot-starter-aop'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
// Querydsl
implementation 'com.querydsl:querydsl-jpa:5.1.0:jakarta'
annotationProcessor 'com.querydsl:querydsl-apt:5.1.0:jakarta'
annotationProcessor 'jakarta.persistence:jakarta.persistence-api:'
annotationProcessor 'jakarta.annotation:jakarta.annotation-api'
// JWT dependency
implementation "io.jsonwebtoken:jjwt-api:0.12.6"
runtimeOnly "io.jsonwebtoken:jjwt-impl:0.12.6"
runtimeOnly "io.jsonwebtoken:jjwt-jackson:0.12.6"
// redis
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.session:spring-session-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
// caffeine
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.github.ben-manes.caffeine:caffeine'
// minio
implementation 'io.minio:minio:8.5.17'
// mongoDB
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
// spring security
implementation 'org.springframework.boot:spring-boot-starter-security'
//netty for message broker
implementation 'org.springframework.boot:spring-boot-starter-reactor-netty'
// REST Docs / test
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.restdocs:spring-restdocs-core'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.boot:spring-boot-starter-data-redis'
testImplementation 'org.springframework.boot:spring-boot-starter-data-redis'
testImplementation 'org.mockito:mockito-core:4.6.1'
// === Testcontainers BOM (버전 중앙관리) ===
testImplementation platform("org.testcontainers:testcontainers-bom:1.20.2")
// === Testcontainers 모듈들 (버전 X, BOM이 관리) ===
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:mongodb'
//testImplementation 'org.testcontainers:redis:1.20.2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'io.projectreactor:reactor-test'
}
spotless {
java {
palantirJavaFormat()
importOrder('java', 'javax', 'jakarta', 'org', 'lombok', 'com')
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
tasks.register("addGitPreCommitHook", Copy) {
from './script/pre-commit'
into './.git/hooks'
}
// --- REST Docs / Asciidoctor 설정 ---
// build/generated-snippets 디렉터리 (Provider 기반)
def snippetsDir = layout.buildDirectory.dir("generated-snippets")
// .env 로부터 테스트 환경변수 로드
def envProps = new Properties()
file('.env').withInputStream { stream ->
stream.withReader('UTF-8') { reader ->
reader.eachLine { line ->
line = line.trim()
if (line && !line.startsWith('#') && line.contains('=')) {
def (k, v) = line.split('=', 2)
envProps[k] = v
}
}
}
}
tasks.named('test', Test) {
useJUnitPlatform()
// REST Docs snippets 출력 디렉터리
outputs.dir(snippetsDir)
environment envProps
def active =
System.getProperty("spring.profiles.active")
?: System.getenv("SPRING_PROFILES_ACTIVE")
?: "test"
systemProperty "spring.profiles.active", active
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat = 'short'
showExceptions = true
showCauses = true
showStackTraces = false
}
}
// Asciidoctor: adoc -> HTML
asciidoctor {
configurations 'asciidoctorExt'
sourceDir = file('src/asciidoc')
// build/docs/asciidoc (Provider API 사용)
outputDir = layout.buildDirectory.dir("docs/asciidoc").get().asFile
sources {
include 'index.adoc'
include 'api/*.adoc'
}
baseDirFollowsSourceFile()
// REST Docs snippets 입력
inputs.dir(snippetsDir)
// 테스트(=snippets 생성) 후에 실행
dependsOn tasks.named('test')
// adoc 에서 {snippets} attribute 쓰고 있다면 이렇게 매핑
attributes 'snippets': snippetsDir.get().asFile
}
// jar 생성 시점에 문서 포함 (src/main/resources 건드리지 않음)
bootJar {
// jar 만들기 전에 asciidoctor 반드시 실행
dependsOn tasks.named('asciidoctor')
// build/docs/asciidoc → jar 내부 static/docs 로 복사
from(layout.buildDirectory.dir("docs/asciidoc")) {
into 'BOOT-INF/classes/static/docs'
}
// docs 변경 시에도 bootJar 를 up-to-date 로 오판하지 않도록 입력에 포함
inputs.dir(layout.buildDirectory.dir("docs/asciidoc"))
}