MSA
멀티 모듈 공통 모듈 적용법.
fouink
2023. 8. 6. 22:25
현재 진행하고 있는 사이드 프로젝트의 멀티모듈 구성은 다음과 같다.
root-project/
├── common/
│ └── build.gradle
├── server-zuul/
│ └── build.gradle
├── server-discovery/
│ └── build.gradle
├── server-mall/
│ └── build.gradle
├── server-oauth/
│ └── build.gradle
└── build.gradle
root-project의 build.gradle에 모든 subProjects의 설정들을 모두 세팅하는 것은 지양하는 것이 좋다고해서
각 모듈의 build.gradle이나 settings.gradle에 공통 모듈 common을 적용 시켰다.
각 모듈의 settings.gradle
rootProject.name = 'product'
include ':common'
project(':common').projectDir = new File(settingsDir, '../common')
build.gradle의 디펜던시
implementation project(':common')
추가해주면 된다