프로젝트 모듈화를 너무 즐기다 함정에 빠졌다.
개발자 가이드에도 모듈화를 너무 작은 단위로 하지 말라는 것을 본적이 있다.
작고 알차게 만들어 보겠다는 생각으로 나눴는데
작은 수정사항이 발생 할 때 마다 여러 모듈을 고쳐야 했고
git반영에 jitpack로 라이브러리까지 만들어야 결과물을 볼 수 있다보니 시간이 너무 오래걸렸다.
그래서 이번에는 모듈을 결합하여 개발을 진행해보기로했다.
어떻게 하면 기존 모듈에 대한 설정변경없이 여러 모듈을 합쳐서 개발할지 생각해보았다.
생각보다 간단하게 해결되었다.
1. 프로젝트 새로 생성하고 github에 업로드하기
https://github.com/sarang628/FindingLinkModules
GitHub - sarang628/FindingLinkModules
Contribute to sarang628/FindingLinkModules development by creating an account on GitHub.
github.com
2. git submodule을 이용하여 결합하고자하는 모듈 추가하기
$ git submodule add https://github.com/sarang628/Finding.git
$ git submodule add https://github.com/sarang628/Map.git
$ git submodule add https://github.com/sarang628/CardInfo.git
$ git submodule add https://github.com/sarang628/Filter.git
3. 모듈 프로젝트 추가하기
이 과정을 진행하면 위에 다운받은 모듈 4개를 함께 추가와 수정이 가능해진다.
rootProject.name = "FindingLinkModules"
include ':app'
include(':finding')
project(':finding').projectDir = new File('./Finding/library')
include(':map')
project(':map').projectDir = new File('./Map/library')
include(':cardInfo')
project(':cardInfo').projectDir = new File('./CardInfo/library')
include(':filter')
project(':filter').projectDir = new File('./Filter/library')
다행히 어렵지 않게 설정 할 수 있어 이제 여러모듈을 함께 수정 할 수 있게 되었다.