-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
155 lines (124 loc) · 4.55 KB
/
build.gradle
File metadata and controls
155 lines (124 loc) · 4.55 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
buildscript {
ext {
springBootVersion = '3.1.4'
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
// Spring Boot Gradle 플러그인 및 Dependency Management 플러그인 추가
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "io.spring.gradle:dependency-management-plugin:1.1.6" // 최신 버전 사용 권장
}
}
allprojects {
// 모든 프로젝트에 Java, Spring Dependency Management, Spring Boot 플러그인 적용
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
group = 'com.lab'
version = '1.0-SNAPSHOT'
java {
// Java 21 버전 설정
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
gradlePluginPortal()
}
}
// root 프로젝트에서 build, bootJar, jar, assemble, compileJava 태스크 비활성화
tasks.named('build') {
doLast {
delete file("${project.rootDir}/build") // build 디렉토리 삭제
}
}
['bootJar', 'jar', 'assemble', 'compileJava'].each { taskName ->
tasks.named(taskName).configure { enabled = false }
}
project(':core') {
// core 모듈에서 test 태스크 비활성화
tasks.named('test') {
enabled = false
}
}
subprojects {
java {
// Java 21 버전 설정
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
testCompileOnly {
extendsFrom annotationProcessor
}
}
dependencies {
// Lombok을 모든 모듈에서 사용 가능하도록 설정
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// Lombok을 테스트에서 사용
// Lombok을 테스트에서 사용할 때 어노테이션 프로세서 적용
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
// jakarta.persistence-api 3.1.0 추가
implementation "jakarta.persistence:jakarta.persistence-api:3.1.0"
// Jakarta Persistence API 추가
annotationProcessor "jakarta.persistence:jakarta.persistence-api:3.1.0"
// 기타 종속성
implementation 'org.liquibase:liquibase-core:4.30.0'
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'com.mysql:mysql-connector-j:9.1.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
// 테스트 종속성 설정
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform() // JUnit 5 플랫폼 사용
}
// Java 컴파일 옵션 설정
compileJava {
options.encoding = 'UTF-8' // Java 소스 파일의 문자 인코딩을 UTF-8로 설정
}
}
/* QueryDSL 라이브러리를 사용하는 모듈 리스트 정의 */
def querydslProjects = [project(":core"),
project(":api"),
project(":admin"),
project(":batch")]
configure(querydslProjects) {
apply plugin: "io.spring.dependency-management"
dependencies {
// QueryDSL 종속성 추가
implementation 'com.querydsl:querydsl-jpa:5.1.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
// Lombok 설정
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
def generatedDir = file("build/generated/sources/annotationProcessor/java/main")
sourceSets {
main {
java {
srcDirs += generatedDir // generated 폴더를 main 소스 세트로 추가
}
}
}
tasks.withType(JavaCompile).configureEach {
options.getGeneratedSourceOutputDirectory().set(file(generatedDir))
}
// clean 작업 시 generated 폴더 삭제
clean.doLast {
generatedDir.deleteDir()
}
}