-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
158 lines (136 loc) · 5.11 KB
/
build.gradle
File metadata and controls
158 lines (136 loc) · 5.11 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
//queryDSL
buildscript {
ext {
queryDslVersion = "5.0.0"
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.9'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
// querydsl 추가
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
// Asciidoctor 플러그인 사용
// gradle 7.0 이상부터는 jvm 사용하기
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
group = 'project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
asciidoctorExtensions // dependencies 에서 적용한 것 추가
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
//jwt
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5', 'io.jsonwebtoken:jjwt-jackson:0.11.5'
//AWS S3
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
//querydsl 추가
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}"
//jackson
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
// h2
runtimeOnly 'com.h2database:h2'
//테스트에서 lombok 사용
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
// mockito
testImplementation 'org.mockito:mockito-inline'
// assured
testImplementation 'io.rest-assured:rest-assured:3.3.0'
// build/generated-snippets 에 생기는 .adoc 조각들을 프로젝트 내의 .adoc 파일을 읽어들 일 수 있도록 연동해준다.
// 이로 인해, .adoc 파일에서 operation 같은 매크로르 사용하여 스니펫 조작들을 연동할 수 있다.
// 최종적으로 .adoc 파일을 HTML로 만들어 export 해준다.
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
// restdocs-mockmvc 의 testCompile 구성 -> mockvMvc를 사용해서 snippets 조각들을 뽑아 낼 수 있다.
// MockMvc 대신 WebTestClient을 사용하려면 spring-restdocs-webtestclient 추가
// MockMvc 대신 REST Assured를 사용하려면 spring-restdocs-restassured 를 추가
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
}
// querydsl 세팅 시작
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main.java.srcDir querydslDir
}
configurations {
querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
// querydsl 세팅 끝
tasks.named('test') {
useJUnitPlatform()
}
//Rest docs 설정
ext {
// 아래에서 사용할 변수 선언
snippetsDir = file('build/generated-snippets')
}
test {
//위의 snippetsDir 디펙토리를 test의 output으로 구성하는 설정
//스니펫 조각들이 build/generated-snippets로 출력된다.
useJUnitPlatform()
outputs.dir snippetsDir
}
asciidoctor { //asciidoctor 관련 설정
dependsOn test //test 작업 이후에 작동하도록 구성하는 설정
configurations 'asciidoctorExtensions' //위에서 작성한 configuration 적용
inputs.dir snippetsDir //snippets 를 입력으로 구성한다.
// source 가 없으면 .adoc 파일을 전부 html로 만들어버림.
// source 지정시 특정 .adoc 파일만 html로 만듬.
sources{
include("**/index.adoc")
}
// 특정 .adoc에 다른 adoc 파일을 가져와서(include) 사용하고 싶을 경우 경로를 baseDir로 맞춰주는 설정입니다.
// 개별 adoc으로 운영한다면 필요 없는 옵션입니다.
baseDirFollowsSourceFile()
}
// 기존에 만들어진 adoc 삭제
asciidoctor.doFirst {
delete file('src/main/resources/static/docs')
}
// asciidoctor 작업 이후 생성된 HTML 파일을 static/docs 로 copy
task copyDocument(type: Copy) {
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}
// build 시 copyDocument 를 의존합니다.
build {
dependsOn copyDocument
}
// bootjar 와 관련된 설정이며, 스니펫을 이용해 문서 작성 후,
// build - docs - asciidoc 하위에 생기는 html 파일을 /static/docs로 복사해줍니다.
bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}"){
into 'static/docs'
}
}