Spring | gradle modularity

DoItDevΒ·2021λ…„ 5μ›” 17일
0
post-thumbnail

πŸ‘‚ λ“€μ–΄κ°€κΈ° μ•žμ„œμ„œ ...

spring boot λΉŒλ“œλ₯Ό ν• λ•Œ gradle 와 maven 으둜 λ‚˜λ‰œλ‹€.
ν•„μžμ˜ 경우 μΈν…”λ¦¬μ œμ΄λ₯Ό μ‚¬μš©μ„ ν•΄μ„œ ν”„λ‘œμ νŠΈ μ„ΈνŒ…μ„ ν•˜λŠ”λ° gradle 둜 주둜 μ„ΈνŒ…μ„ ν•œλ‹€.
이번 ν¬μŠ€νŒ…μ—μ„œλŠ” κ·Έλ ˆλ“€μ˜ λͺ¨λ“ˆν™”에 λŒ€ν•΄μ„œ μž‘μ„±μ„ν•˜λ €κ΅¬ ν•œλ‹€.

πŸ₯Έ Gradle μ΄λž€ ?

Gradle은 그루비λ₯Ό μ΄μš©ν•œ λΉŒλ“œ μžλ™ν™” μ‹œμŠ€ν…œμ΄λ‹€. Groovy와 μœ μ‚¬ν•œ 도메인 μ–Έμ–΄λ₯Ό μ±„μš©ν•˜μ˜€μœΌλ©°, ν˜„μž¬ μ•ˆλ“œλ‘œμ΄λ“œ 앱을 λ§Œλ“œλŠ”λ° ν•„μš”ν•œ μ•ˆλ“œλ‘œμ΄λ“œ μŠ€νŠœλ””μ˜€μ˜ 곡식 λΉŒλ“œ μ‹œμŠ€ν…œμ΄κΈ°λ„ ν•˜λ‹€. Java, C/C++, 파이썬 λ“±κ³Ό 같은 μ—¬λŸ¬ 가지 μ–Έμ–΄λ₯Ό μ§€μ›ν•œλ‹€.
μ°Έμ‘°

Spring boot Gradle λͺ¨λ“ˆν™”

μ—¬λŸ¬κ°€μ§€ ν”„λ‘œμ νŠΈλ₯Ό μ‚¬μš©μ„ ν• λ•Œ μ‚¬μš©ν•˜κΈ°λ„ ν•˜κ³  λ˜λŠ” ν΄λΌμ΄μ–ΈνŠΈ λͺ¨λ“ˆμ„ λ§Œλ“€μ–΄μ„œ μ„œλ²„ λͺ¨λ“ˆ 두가지 λͺ¨λ“ˆμ„ μ‚¬μš©μ„ ν•  λ•Œ 많이 μ‚¬μš©μ„ ν•œλ‹€.

μŠ€ν¬λ¦°μƒ· 2021-05-17 μ˜€ν›„ 6 59 25 ν”„λ‘œμ νŠΈ ꡬ쑰

ν•„μžλŠ” μœ„μ™€ 같이 ν”„λ‘œμ νŠΈ 2개λ₯Ό λ¬Άμ–΄μ„œ μ‚¬μš©μ„ ν•˜λ €κ³  ν•œλ‹€.
setting.gradle build.gradle gradlew gradlew.bat 4개의 νŒŒμΌμ„ λ§Œλ“€μ–΄ μ€λ‹ˆλ‹€.

setting.gradle

rootProject.name = 'spring-app'

include 'jpa'
include 'security'

rootProject.name 은 ν”„λ‘œμ νŠΈμ˜ 루트 λͺ…을 μ μ–΄μ£Όλ©΄λœλ‹€.
include μ•ˆμ—λŠ” μ„œλΈŒ ν”„λ‘œμ νŠΈ λͺ…을 적어쀀닀.

build.gradle

defaultTasks 'build'

wrapper {
    description "Regenerates the Gradle Wrapper files"
    gradleVersion = '6.8.3'
    distributionUrl = "http://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}

μ—¬κΈ°μ„œ 총 ν”„λ‘œμ νŠΈ build λ₯Ό 적어쀀닀.

μŠ€ν¬λ¦°μƒ· 2021-05-17 μ˜€ν›„ 7 12 17 gradle λͺ¨λ“ˆν™”

μœ„μ˜ μ‚¬μ§„μ—μ„œ gradle 폴더λ₯Ό 보면 gradle file 둜 λͺ¨λ“ˆν™”λ₯Ό ν•  수 μžˆλ‹€.
그럼 μ–΄λ–»κ²Œ ν•΄μ•Όλ˜λ‚˜ ..?

μ„œλΈŒ ν”„λ‘œμ νŠΈ build.gradle

 apply from: "${project.rootDir.toString()}/gradle/pg.gradle"

apply from μ ˆλŒ€ 경둜둜 μ‚¬μš©μ„ ν•˜λ©΄ μ‚¬μš©μ΄ κ°€λŠ₯ν•˜λ‹€

profile
Back-End Engineer

0개의 λŒ“κΈ€