Spring Initializr에서 프로젝트를 생성합니다.
그리고 저는 주로 사용하지 않을 src 폴더를 삭제합니다.
build.gradle을 먼저 작성해볼게요.
build.gradle
buildscript {
ext {
springBootVersion = '2.6.3'
dependencyManagementVersion = '1.0.11.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:${dependencyManagementVersion}"
}
}
}
allprojects {
group = 'com.example'
version = '1.0.0'
}
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
tasks.named('test') {
useJUnitPlatform()
}
}
project(':sample-api') {
dependencies {
implementation project(':sample-domain')
}
}
project(':sample-batch') {
dependencies {
implementation project(':sample-domain')
}
}
project(':sample-domain') {
}
settings.gradle
rootProject.name = 'sample'
include 'sample-api'
include 'sample-batch'
include 'sample-domain'
서브프로젝트는 src 폴더와 build.gradle 제외하고 필요한 것 빼고 필요 없습니다.
이렇게 설정하면 기본적으로 멀티 프로젝트 세팅은 완료된거에요.
'Backend > Spring' 카테고리의 다른 글
Spring Boot Reactive Redis Transaction (0) | 2022.02.15 |
---|---|
Spring Webflux ExceptionHandler Functional Endpoints (0) | 2021.08.14 |
Spring Boot ReactiveRedisTemplate<String, Integer> (0) | 2021.08.14 |
Spring Boot MongoDB multi-document transactions (0) | 2021.08.14 |
Spring Webflux Annotated Controller @ClientIp (0) | 2021.07.31 |