-
Notifications
You must be signed in to change notification settings - Fork 0
[YS-391] chore: 루트 프로젝트 build.gradle 정리 및 Ktlint 적용 #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough이번 PR은 두 가지 주요 변경 사항을 포함합니다. 첫째, 프로젝트의 최상위에 위치하는 새 Changes
Suggested labels
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- 루트 build.gradle.kts 에서 모든 서브모듈에 공통 적용할 필요 없는 플러그인 선언을 제거하고, essential한 설정만 남김
settings.gradle - 각 모듈의 빌드 스크립트에 흩어져있던 플러그인 버전관리를 settings.gradle의 pluginManagement로 이동 - 플러그인 버전 일관성
| pluginManagement { | ||
| plugins { | ||
| id("org.jetbrains.kotlin.jvm") version "1.9.25" | ||
| id("org.jetbrains.kotlin.plugin.spring") version "1.9.25" | ||
| id("org.jetbrains.kotlin.plugin.jpa") version "1.9.25" | ||
| id("org.jetbrains.kotlin.kapt") version "1.9.25" | ||
| id("org.springframework.boot") version "3.4.1" | ||
| id("io.spring.dependency-management") version "1.1.7" | ||
| id("org.jlleitschuh.gradle.ktlint") version "11.6.1" | ||
| } | ||
| repositories { | ||
| gradlePluginPortal() | ||
| mavenCentral() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에는 각 모듈에서 버전을 명시해줘서 버전 관리가 흩어져서 각 모듈 간의 버전 충돌이 발생할 수 있겠다는 우려가 있었어요. 🥺
따라서 pluginManagement 블록을 통해 모든 하위 모듈에서 사용하는 플러그인들의 버전을 한 곳에서 통합 관리하도록 리팩토링했습니다.
이 설정을 settings.gradle.kts 에 둔 이유는, gradle이 프로젝트 초기화 시점에 pluginManagement 블록을 가장 먼저 읽는다는 이유 때문이었어요.
따라서 하위 모듈에서 사용하는 플러그인 버전들을 전역적으로 일관되게 관리하기 위해서는 settings.gradle.kts 에 정의하는 것이 가장 안전하고 권장되는 방법이라고 판단했습니다. 🤔
참고로, 제가 참고한 Gradle 공식 문서 > Plugin Management 챕터에서도 플러그인 버전 관리를 settings.gradle.kts 파일의 최상단에 위치시키는 것이 best practice라고 합니다!
이런 리팩토링 방향성에 대해 지수님의 의견이 듣고 싶습니다. ✨👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 리팩토링입니다! 여러 모듈에서 버전을 따로 관리하면 충돌이 생길 수 있는데, pluginManagement 블록을 통해 한 곳에서 버전을 관리하면 안정적이고 일관성 있게 관리할 수 있겠네요. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 common 계층을 만들면서 bootjar 비활성화 코드를 빠뜨렸네요...!
common에도 다른 모듈처럼 아래 코드 추가해주시면 감사하겠습니다~
tasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
enabled = false
}
tasks.getByName<Jar>("jar") {
enabled = true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지수님께서 common 모듈 작업하면서 당시 common 모듈에 해당 bootJar 비활성화 코드를 추가하지 않으신 이유가 bootJar 비활성화 코드가 스프링 프레임워크에 의존하고 있기 때문이 아닐까... 하는 생각이 듭니다!
현재 domain 모듈이 common 모듈을 의존하고 있어서, common 에 스프링 관련 설정이 들어가면 의존성 전파로 인해 도메인 계층까지 스프링에 물들게 되는 구조가 되는지라 이 부분을 의도적으로 분리하신 게 아닐까 싶어요 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 맞습니다. 이 부분은 지금처럼 유지해주시면 되겠습니다! 👍
| subprojects { | ||
| repositories { | ||
| mavenCentral() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
각 모듈에서 공통으로 사용할 부분은 subprojects로 관리하는 점 좋습니다!
아래처럼 mavenCentral()뿐만 아니라 kotlin("jvm"), ktlint 같은 플러그인도 함께 관리하면 더 깔끔할 것 같은데 어떻게 생각하시나요??
| subprojects { | |
| repositories { | |
| mavenCentral() | |
| } | |
| plugins { | |
| kotlin("jvm") version "1.9.25" apply false | |
| id("org.jlleitschuh.gradle.ktlint") apply false | |
| } | |
| subprojects { | |
| apply(plugin = "kotlin") | |
| apply(plugin = "org.jlleitschuh.gradle.ktlint") | |
| java { | |
| toolchain { | |
| languageVersion.set(JavaLanguageVersion.of(17)) | |
| } | |
| } | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| implementation("org.jetbrains.kotlin:kotlin-stdlib") | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지수님 의견처럼 루트에서 공통 플러그인은 apply(plugin = "...") 로 일괄 적용하는 게
실제로 더 간편하고 실용적인 접근이라는 점에 완전히 공감합니다!
다만 이번 프로젝트는 클린 아키텍처 패턴을 strict하게 적용하는 게 목표이다 보니, 각 모듈에서 사용하는 플러그인을 명시적으로 선언해서 설정의 책임을 분리하고 모듈 간 의존성도 더 명확히 드러내는 방식에 저는 개인적으로 조금 더 마음이 끌리네요,,, 👀 😊
혹시 요런 방식에 대해서는 어떻게 생각하시나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
각 모듈에서 사용하는 플러그인과 라이브러리를 명확히 선언하는 차원에서, group과 version만 추가하는 것도 좋은 방법일 것 같아요! 👍
| group = "com.dobby" | ||
| version = "0.0.1-SNAPSHOT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모든 서브 모듈이 동일한 그룹 ID와 버전을 공유할 수 있도록 그룹과 버전은 루트 build.gradle에 그대로 두는 게 좋아보입니다!
group = "com.dobby"
version = "0.0.1-SNAPSHOT"
| pluginManagement { | ||
| plugins { | ||
| id("org.jetbrains.kotlin.jvm") version "1.9.25" | ||
| id("org.jetbrains.kotlin.plugin.spring") version "1.9.25" | ||
| id("org.jetbrains.kotlin.plugin.jpa") version "1.9.25" | ||
| id("org.jetbrains.kotlin.kapt") version "1.9.25" | ||
| id("org.springframework.boot") version "3.4.1" | ||
| id("io.spring.dependency-management") version "1.1.7" | ||
| id("org.jlleitschuh.gradle.ktlint") version "11.6.1" | ||
| } | ||
| repositories { | ||
| gradlePluginPortal() | ||
| mavenCentral() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 리팩토링입니다! 여러 모듈에서 버전을 따로 관리하면 충돌이 생길 수 있는데, pluginManagement 블록을 통해 한 곳에서 버전을 관리하면 안정적이고 일관성 있게 관리할 수 있겠네요. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
build.gradle.kts (1)
1-5: 서브 프로젝트의 저장소 설정 검토
subprojects블록 내에repositories섹션을 정의하여 모든 서브 프로젝트에 대해mavenCentral()을 사용하도록 한 점은 모듈화된 구조에서 일관성을 유지하는 좋은 접근입니다. 다만, 향후 특정 모듈에서 추가 저장소나 별도의 저장소 설정이 필요할 경우 이를 유연하게 확장할 수 있도록 고려해주시면 좋겠습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
build.gradle.kts(1 hunks)infrastructure/build.gradle.kts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- infrastructure/build.gradle.kts
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (2)
build.gradle.kts (2)
7-8: 루트 프로젝트의 그룹 및 버전 설정 검토
루트 빌드 파일에group과version을 정의하여 서브 모듈들이 동일한 그룹과 버전을 공유하도록 한 점은 모듈 간 일관성 유지 측면에서 적절합니다.
1-9: Ktlint 설정 적용 대상 확인 요청
PR 설명에 따르면, Ktlint가 코틀린을 사용하는 모듈에만 적용되어야 하는데, 현재 이 파일에서는 Ktlint 관련 설정이 보이지 않습니다.
혹시 별도의 설정 파일(예:settings.gradle.kts또는 개별 모듈의build.gradle.kts)에서 관련 구성이 이루어졌는지 확인 부탁드립니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 고생하셨습니다! 👍
💡 작업 내용
Ktlint를 적용했습니다.✅ 셀프 체크리스트
🙋🏻 확인해주세요
Summary by CodeRabbit
Style
Chores
🔗 Jira 티켓
https://yappsocks.atlassian.net/browse/YS-391