-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
178 lines (150 loc) · 6.21 KB
/
build.gradle.kts
File metadata and controls
178 lines (150 loc) · 6.21 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
import org.gradle.api.tasks.bundling.Zip
import org.springframework.boot.gradle.tasks.bundling.BootJar
/* =====================================================
* Versions
* ===================================================== */
val googleJavaFormatVersion = "1.18.1"
val jacksonCoreVersion = property("jacksonDataBindVersion").toString()
val okHttpVersion = property("okHttp3Version").toString()
val gsonVersion = property("gsonVersion").toString()
val bouncycastleVersion = property("bouncycastleVersion").toString()
val redissonVersion = property("redissonVersion").toString()
val javaContainerVersion = property("javaContainerVersion").toString()
val javaCore = property("javaCore").toString()
val javaEvents = property("javaEvents").toString()
/* =====================================================
* Build Profile
* ===================================================== */
val profile: String = project.findProperty("profile") as? String ?: "local"
//val isLambdaProfile = profile == "dev" || profile == "prod"
val isLambdaProfile = profile == "dev" // todo: 추후 prod 환경도 람다로 배포할 시 위 변수로 치환
println("▶ Build Profile = $profile (lambda profile=$isLambdaProfile)")
/* =====================================================
* Plugins
* ===================================================== */
plugins {
java
id("org.springframework.boot") version "3.3.5"
id("io.spring.dependency-management") version "1.1.6"
id("com.diffplug.spotless")
}
/* =====================================================
* Project Info
* ===================================================== */
group = property("projectGroup").toString()
version = property("applicationVersion").toString()
repositories {
mavenCentral()
}
/* =====================================================
* Java
* ===================================================== */
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
/* =====================================================
* Dependencies
* ===================================================== */
dependencies {
/* ---------- Web ---------- */
if (isLambdaProfile) {
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude(group = "org.springframework.boot", module = "spring-boot-starter-tomcat")
}
} else {
implementation("org.springframework.boot:spring-boot-starter-web")
}
/* ---------- Spring Core ---------- */
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-oauth2-resource-server")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.retry:spring-retry")
/* ---------- Observability ---------- */
implementation("io.micrometer:micrometer-registry-prometheus-simpleclient")
/* ---------- Serialization / HTTP ---------- */
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonCoreVersion")
implementation("com.squareup.okhttp3:okhttp:$okHttpVersion")
implementation("com.google.code.gson:gson:$gsonVersion")
/* ---------- Crypto ---------- */
implementation("org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion")
implementation("org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion")
/* ---------- AWS SDK ---------- */
implementation("software.amazon.awssdk:s3:2.20.26")
/* ---------- AWS Lambda ---------- */
implementation("com.amazonaws.serverless:aws-serverless-java-container-springboot3:${javaContainerVersion}")
implementation("com.amazonaws:aws-lambda-java-core:${javaCore}")
implementation("com.amazonaws:aws-lambda-java-events:${javaEvents}")
/* ---------- Cache ---------- */
implementation("org.redisson:redisson-spring-boot-starter:${redissonVersion}")
/* ---------- DB ---------- */
runtimeOnly("org.postgresql:postgresql")
/* ---------- Lombok ---------- */
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
/* ---------- Test ---------- */
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("com.h2database:h2")
}
/* =====================================================
* Spotless
* ===================================================== */
spotless {
java {
target("**/*.java")
googleJavaFormat(googleJavaFormatVersion)
importOrder("sopt", "java", "javax", "jakarta", "org", "com")
endWithNewline()
removeUnusedImports()
}
}
/* =====================================================
* Test
* ===================================================== */
tasks.withType<Test> {
useJUnitPlatform()
}
/* =====================================================
* BootJar / Jar
* ===================================================== */
tasks.named<BootJar>("bootJar") {
enabled = true
archiveFileName.set("authentication.jar")
}
tasks.named<Jar>("jar") {
enabled = true
archiveClassifier.set("")
}
/* =====================================================
* Lambda ZIP (Packaging Only)
* ===================================================== */
tasks.register<Zip>("lambdaJar") {
group = "distribution"
description = "Build AWS Lambda deployment ZIP"
dependsOn(tasks.named("jar"))
archiveClassifier.set("lambda")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
isZip64 = true
// Lambda 표준 구조: lib/
into("lib") {
from(tasks.named("jar"))
from(configurations.runtimeClasspath) {
exclude("org/apache/tomcat/embed/**")
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
exclude("META-INF/MANIFEST.MF")
exclude("**/module-info.class")
}
}
}