Skip to content

Commit ed2a825

Browse files
authored
GETP-323 refactor: 단위 모듈 프로젝트를 멀티 모듈로 분리 (#180)
* GETP-323 refactor: 단일 모듈에서 api, domain, persistence, application, infrastructure 모듈로 분리 * GETP-323 refactor: domain 모듈의 타 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 project 컴포넌트에서 api 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 auth 컴포넌트에서 api, persistence 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 client 컴포넌트에서 api 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 member 컴포넌트에서 api 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 like 컴포넌트에서 persistence 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 people 컴포넌트에서 api, persistence 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 service term 컴포넌트에서 api 모듈에 대한 의존성 제거 * GETP-323 refactor: application 모듈의 storage 컴포넌트에서 infrastructure 모듈에 대한 의존성 제거 * GETP-323 refactor: persistence 모듈에서 사용하지 않는 fixture 제거 및 api 모듈에 대한 의존성 제거 * GETP-323 refactor: api 모듈의 fixture 패키지 정리 * GETP-323 rename: docs 파일을 api 모듈의 src 디렉토리 안으로 이동 * GETP-323 refactor: application 모듈의 persistence, api 모듈에 대한 의존성 제거 * GETP-323 remove: static 파일 제거 * GETP-323 chore: 모듈 간 의존성 설정 및 Dockerfile이 api 모듈의 빌드 결과를 실행하도록 변경 * GETP-323 remove: 사용하지 않는 유틸 클래스 삭제 * GETP-323 chore: application.yml을 각 모듈에 대해 분리 * GETP-323 chore: 테스트 후 테스트 결과를 build/test-results로 수집 * GETP-323 rename: 테스트 시 자동으로 테스트 환경 설정 인식하도록 설정 파일 이름 변경 * GETP-323 remove: api 모듈에서 사용하지 않는 static 파일 제거
1 parent 5b41660 commit ed2a825

File tree

721 files changed

+1685
-1148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

721 files changed

+1685
-1148
lines changed

.gitignore

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ derby.log
1818
# Gradle artifacts
1919
.gradle
2020
.gradletasknamecache
21-
/build
22-
buildSrc/build
23-
/spring-*/build
24-
/framework-*/build
25-
/integration-tests/build
26-
/src/asciidoc/build
27-
spring-test/test-output/
21+
**/build
22+
**/buildSrc/build
23+
**/spring-*/build
24+
**/framework-*/build
25+
**/integration-tests/build
26+
**/src/asciidoc/build
27+
**/spring-test/test-output/
2828

2929
# Maven artifacts
3030
pom.xml
@@ -104,9 +104,9 @@ local.sh
104104
.run/
105105

106106
# Static Resources
107-
src/main/resources/static/*
108-
src/test/resources/static/*
109-
./storage
107+
**/src/main/resources/static/docs/*
108+
**/src/main/resources/static/oas/*
109+
storage/*
110110

111111
# Yml File
112112
local-docker-compose.yml

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM openjdk:17-jdk
22

3-
ARG JAR_FILE=build/libs/*.jar
3+
ARG JAR_FILE=get-p-api/build/libs/*.jar
44
ADD ${JAR_FILE} app.jar
55

66
ENTRYPOINT ["java", "-Duser.timezone=GMT+9", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=dev", "-jar", "/app.jar"]

build.gradle

Lines changed: 51 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,208 +1,77 @@
1-
import org.yaml.snakeyaml.DumperOptions
2-
import org.yaml.snakeyaml.Yaml
3-
41
plugins {
52
id 'java'
63
id 'org.springframework.boot' version '3.1.4'
74
id 'io.spring.dependency-management' version '1.1.3'
8-
id 'org.asciidoctor.jvm.convert' version '4.0.2'
9-
id 'com.epages.restdocs-api-spec' version '0.18.2'
10-
}
11-
12-
group = 'es.princip'
13-
version = '0.0.1-SNAPSHOT'
14-
15-
java {
16-
sourceCompatibility = '17'
5+
id 'java-library'
6+
id 'java-test-fixtures'
7+
id 'maven-publish'
178
}
189

19-
repositories {
20-
mavenCentral()
21-
}
10+
allprojects {
11+
group = 'es.princip'
12+
version = '0.0.1-SNAPSHOT'
2213

23-
configurations {
24-
compileOnly {
25-
extendsFrom annotationProcessor
14+
repositories {
15+
mavenCentral()
2616
}
27-
asciidoctorExt
28-
}
29-
30-
dependencies {
31-
implementation 'org.springframework.boot:spring-boot-starter-web'
32-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
33-
developmentOnly 'org.springframework.boot:spring-boot-devtools'
34-
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
35-
36-
// Validation
37-
implementation 'org.springframework.boot:spring-boot-starter-validation'
38-
implementation 'org.apache.tika:tika-core:2.9.1'
39-
40-
// Jpa
41-
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
42-
43-
// Security
44-
implementation 'org.springframework.boot:spring-boot-starter-security'
45-
testImplementation 'org.springframework.security:spring-security-test'
46-
47-
// Jwt
48-
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
49-
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
50-
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
51-
52-
// Database
53-
runtimeOnly 'com.mysql:mysql-connector-j:9.0.0'
54-
implementation 'org.flywaydb:flyway-core'
55-
implementation 'org.flywaydb:flyway-mysql'
56-
57-
// Lombok
58-
compileOnly 'org.projectlombok:lombok'
59-
annotationProcessor 'org.projectlombok:lombok'
60-
testCompileOnly 'org.projectlombok:lombok'
61-
testAnnotationProcessor 'org.projectlombok:lombok'
62-
63-
// WebSocket
64-
implementation 'org.springframework:spring-websocket:6.0.13'
65-
66-
// QueryDSL
67-
implementation "com.querydsl:querydsl-jpa:5.0.0:jakarta"
68-
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
69-
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
70-
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
71-
72-
// Redis
73-
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
74-
75-
// Mail
76-
implementation 'com.sun.mail:jakarta.mail:2.0.1'
77-
implementation 'org.springframework.boot:spring-boot-starter-mail:3.2.1'
78-
79-
// MapStruct
80-
implementation 'org.mapstruct:mapstruct:1.6.0'
81-
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.0'
82-
83-
// AOP
84-
implementation 'org.springframework.boot:spring-boot-starter-aop'
85-
86-
// Test Containers
87-
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
88-
testImplementation 'org.testcontainers:testcontainers:1.19.3'
89-
testImplementation 'org.testcontainers:junit-jupiter:1.19.3'
90-
testImplementation 'org.testcontainers:mysql:1.20.0'
91-
92-
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1'
93-
94-
// Swagger
95-
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.4.0'
96-
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.18.2'
97-
98-
// Monitoring
99-
implementation 'org.springframework.boot:spring-boot-starter-actuator'
100-
implementation 'io.micrometer:micrometer-registry-prometheus'
101-
102-
// Spring REST Docs
103-
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
104-
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
10517
}
10618

107-
ext {
108-
snippetsDir = file('build/generated-snippets')
109-
}
110-
111-
test {
112-
outputs.dir snippetsDir
113-
useJUnitPlatform()
114-
}
115-
116-
asciidoctor {
117-
inputs.dir snippetsDir
118-
configurations 'asciidoctorExt'
119-
dependsOn test
120-
sources {
121-
include('**/index.adoc')
19+
subprojects {
20+
apply plugin: 'java'
21+
apply plugin: 'org.springframework.boot'
22+
apply plugin: 'io.spring.dependency-management'
23+
apply plugin: 'java-library'
24+
apply plugin: 'java-test-fixtures'
25+
apply plugin: 'maven-publish'
26+
27+
java {
28+
sourceCompatibility = '17'
29+
targetCompatibility = '17'
12230
}
123-
baseDirFollowsSourceFile()
124-
}
12531

126-
tasks.register('copyDocument', Copy) {
127-
dependsOn asciidoctor
128-
doFirst {
129-
delete file('src/main/resources/static/docs')
32+
configurations {
33+
compileOnly {
34+
extendsFrom annotationProcessor
35+
}
13036
}
131-
from asciidoctor.outputDir
132-
into file('src/main/resources/static/docs')
133-
}
13437

135-
openapi3 {
136-
servers = [
137-
{
138-
url = 'https://api.principes.xyz'
139-
description = '개발 서버'
140-
},
141-
{
142-
url = 'http://localhost:57020'
143-
description = '로컬 서버'
144-
}
145-
]
146-
title = 'GET-P API'
147-
description = 'GET-P API 명세서'
148-
version = '0.1.0'
149-
format = 'yaml'
150-
}
38+
test {
39+
useJUnitPlatform()
40+
}
15141

152-
tasks.register('addSecurityConfig') {
153-
dependsOn('openapi3')
154-
doFirst {
155-
def path = "${openapi3.outputDirectory}/openapi3.yaml"
156-
def yaml = new Yaml()
157-
def file = new File(path)
158-
def data = yaml.load(new InputStreamReader(new FileInputStream(new File(path)), 'UTF-8'))
42+
tasks.register('copyTestResults', Copy) {
43+
from 'build/test-results'
44+
into '../build/test-results'
45+
include '**/*.xml'
46+
}
15947

160-
def components = data?.components ?: [:]
161-
def JWT = [
162-
type: 'http',
163-
scheme: 'bearer',
164-
bearerFormat: 'JWT'
165-
]
166-
def security = [[JWT: []]]
167-
def securitySchemas = [JWT: JWT]
48+
test.finalizedBy(copyTestResults)
16849

169-
components.securitySchemes = securitySchemas
170-
data.security = security
50+
dependencies {
51+
// Lombok 라이브러리
52+
compileOnly 'org.projectlombok:lombok:1.18.34'
53+
annotationProcessor 'org.projectlombok:lombok:1.18.34'
54+
testCompileOnly 'org.projectlombok:lombok:1.18.34'
55+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
17156

172-
def options = new DumperOptions().with {
173-
defaultFlowStyle = DumperOptions.FlowStyle.BLOCK
174-
prettyFlow = true
175-
indent = 2
176-
it
177-
}
178-
def converted = new Yaml(options)
179-
def writer = new OutputStreamWriter(new FileOutputStream(file), 'UTF-8')
57+
// MapStruct 라이브러리
58+
implementation 'org.mapstruct:mapstruct:1.6.0'
59+
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.0'
18060

181-
converted.dump(data, writer)
182-
}
183-
}
61+
// Jackson 라이브러리
62+
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1'
18463

185-
tasks.register('copyOas', Copy) {
186-
dependsOn('addSecurityConfig')
187-
doFirst {
188-
delete file('src/main/resources/static/oas')
64+
// 테스트 프레임워크
65+
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.3.5'
66+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
67+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
18968
}
190-
from openapi3.outputDirectory
191-
into file('src/main/resources/static/oas')
19269
}
19370

194-
build {
195-
dependsOn copyDocument
196-
dependsOn copyOas
71+
bootJar {
72+
enabled = false
19773
}
19874

199-
bootJar {
200-
dependsOn copyDocument
201-
dependsOn copyOas
202-
from (asciidoctor.outputDir) {
203-
into 'static/docs'
204-
}
205-
from (openapi3.outputDirectory) {
206-
into 'static/oas'
207-
}
75+
jar {
76+
enabled = true
20877
}

0 commit comments

Comments
 (0)