-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
128 lines (108 loc) · 4.49 KB
/
build.gradle
File metadata and controls
128 lines (108 loc) · 4.49 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
// buildscript 블록
// 플러그인 자체와, 플러그인이 사용할 MySQL 라이브러리를 함께 정의.
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
def flywayVersion = "11.11.2"
classpath "org.flywaydb:flyway-gradle-plugin:${flywayVersion}"
classpath "org.flywaydb:flyway-mysql:${flywayVersion}"
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.5'
id 'io.spring.dependency-management' version '1.1.7'
// id 'org.flywaydb.flyway' version "11.11.2"
}
// buildscript에 정의한 플러그인 적용.
apply plugin: 'org.flywaydb.flyway'
group = 'com.issueDive'
version = '0.0.1-SNAPSHOT'
description = 'issueDive'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.mysql:mysql-connector-j'
// --- Flyway ---
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql' // flywayClean 같은 명령어 직접 사용 시 필요. 라이브러리 지정.
// --- 테스트 의존성 ---
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
testImplementation 'com.h2database:h2'
runtimeOnly 'com.h2database:h2'
// 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"
// API docs
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.11'
// JWT 의존성 추가
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
// --- 로깅 및 모니터링 ---
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-actuator' // Spring Boot Actuator
implementation 'io.micrometer:micrometer-registry-prometheus' // Micrometer (Prometheus 연동을 위함)
// XSS 방어를 위한 HTML Sanitizer 라이브러리
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20220608.1'
// implementation이 맞는지 확인 (compile이나 runtimeOnly가 아닌)
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'io.lettuce:lettuce-core'
}
// Query DSL 설정
clean{
delete file('src/main/generated')
}
tasks.named('test') {
useJUnitPlatform()
systemProperties(System.getProperties())
jvmArgs '-Xshare:off'
}
// Flyway 설정
flyway {
// project.hasProperty()를 사용해 'dbUrl' 프로퍼티가 있을 때만 설정을 적용합니다.
// 이렇게 하면 CI 환경처럼 DB 정보가 없을 때 이 블록을 건너뛰게 됩니다.
// CI 환경 등에서 dbUrl 프로퍼티가 없을 수 있으므로,
// 해당 프로퍼티가 존재할 때만 url, user, password를 설정합니다.
if (project.hasProperty('dbUrl')) {
url = dbUrl
user = dbUser
password = dbPassword
}
locations = ['filesystem:src/main/resources/db/migration']
// cleanDisabled는 DB 연결 정보와 무관하므로 바깥에 두어도 안전합니다.
cleanDisabled = false
// 테스트 프로퍼티 파일을 참조하도록 설정
// configFiles = ['src/test/resources/application-test.properties']
}
bootJar { archiveFileName = 'app.jar' }
// Spring Boot가 실행 불가능한 -plain.jar 파일을 생성하지 않도록 설정합니다.
// 이렇게 하면 build/libs 폴더에는 실행 가능한 Fat JAR 파일 하나만 남게 됩니다.
tasks.named('jar', Jar) {
enabled = false
}