스프링 공식 문서를 기준으로 작성하였습니다.
프로젝트명 우클릭 -> new -> module을 추가한다
위에서 config와 application 모듈 두개를 생성하였다.
위 방식처럼 생성하였다면 자동으로 include가 되어있다.
없다면 include '모듈명' 을 추가한다.
rootProject.name = 'multi_module_project'
include 'config'
include 'application'
root 프로젝트의 build.gradle을 설정한다.
여기서는 모든 프로젝트와 하위 프로젝트를 공통으로 설정하였다.
allprojects { // 모든 프로젝트에 적용
apply plugin: 'java'
group = 'org.example'
version ='1.0-SNAPSHOT'
sourceCompatibility = '11'
}
subprojects { // 하위 프로젝트에서 공통으로 설정
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
}