-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
157 lines (131 loc) · 5.17 KB
/
build.gradle
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
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.1'
id 'io.spring.dependency-management' version '1.1.0'
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'com.diffplug.spotless' version '6.11.0'
// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
group = 'com.sirius'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
jsondoclet
}
repositories {
mavenCentral()
}
ext {
snippetsDir = file('build/generated-snippets') // snippet 이 생성될 디렉토리 지정
javadocJsonDir = file("$buildDir/generated-javadoc-json") // javadoc-json 이 생성될 디렉토리 지정
// querydslDir = file("$buildDir/generated/querydsl) // javadoc-json 이 생성될 디렉토리 지정
// def querydslDir = "$buildDir/generated/querydsl"
}
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-validation'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
runtimeOnly 'com.mysql:mysql-connector-j'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'capital.scalable:spring-auto-restdocs-core:2.0.11'
jsondoclet 'capital.scalable:spring-auto-restdocs-json-doclet-jdk9:2.0.11'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'io.projectreactor:reactor-test'
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
// == 스프링 부트 3.0 이상 ==
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"
testImplementation 'com.h2database:h2:2.1.214'
compileOnly('com.h2database:h2:2.1.214')
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation group: 'com.auth0', name: 'java-jwt', version: '4.2.1'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
}
// === Querydsl 빌드 옵션 ===
def querydslDir = "$buildDir/generated/querydsl"
sourceSets {
main.java.srcDirs += querydslDir
}
tasks.withType(JavaCompile) {
options.annotationProcessorGeneratedSourcesDirectory = file(querydslDir)
}
task jsonDoclet(type: Javadoc, dependsOn: compileTestJava) {
source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath
destinationDir = javadocJsonDir
options.docletpath = configurations.jsondoclet.files.asType(List)
options.doclet = 'capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet'
options.memberLevel = JavadocMemberLevel.PACKAGE
}
spotless {
java {
// generated 폴더는 제외
target project.fileTree(project.rootDir) {
include '**/*.java'
exclude '**/generated/**/*.*'
}
// 사용하지 않는 import 제거
removeUnusedImports()
// 구글 자바 포맷 적용
googleJavaFormat()
indentWithTabs(2)
indentWithSpaces(4)
// 공백 제거
trimTrailingWhitespace()
// 끝부분 New Line 처리
endWithNewline()
}
}
// 의존성을 설정해줌 test 끝나고 spotlessjava 수행되도록
// tasks.named("spotlessJava").configure { dependsOn("compileTestJava") }
tasks.named("spotlessJava").configure {dependsOn("asciidoctor")}
// 테스트 실행 후, snipperDir에 snippet(.adoc 파일들) 생성
test {
systemProperty 'org.springframework.restdocs.outputDir', snippetsDir
systemProperty 'org.springframework.restdocs.javadocJsonDir', javadocJsonDir
dependsOn jsonDoclet
useJUnitPlatform()
outputs.dir snippetsDir
}
// src/docs/asciidoc/*.adoc 파일을 build/docs/asciidoc에 *.html 파일로 변환
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
asciidoctor.doFirst {
delete file('src/main/resources/static/docs')
}
// build/docs/asciidoc 파일을 src/main/resources/static/docs 패키지로 이동
//task copyDocument(type: Copy) {
// dependsOn asciidoctor
//// from file("build/docs/asciidoc")
//// into file("src/main/resources/static/docs")
//}
// assemble을 copyDocument에 의존하게 하여, assemble보다 copyDocument가 먼저 실행되도록 함
// jar 파일은 copyDocument가 끝나야 생성이 됨
assemble {
dependsOn asciidoctor
}
bootJar{
archiveFileName = 'spurt.jar'
}
jar{
enabled = false
}