๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
TIL/Spring

SpringBoot - build.gradle์˜ ์ดํ•ด

by Edlin 2022. 6. 23.

* ์ฝ”๋“œ์˜ ์ดํ•ด

buildscript {
    /*
     * ext: ์ „์—ญ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•˜๊ฒ ๋‹ค.
     * 'springBootVersion' ์ด๋ผ๋Š” ์ „์—ญ๋ณ€์ˆ˜์˜ ๊ฐ’์€ '2.1.7 RELEASE' ์ด๋‹ค.
     *  */
    ext {
        springBootVersion = '2.1.7.RELEASE'
    }

    repositories {
        mavenCentral()
        /*
        * jcenter(): ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—…๋กœ๋“œ ๋•Œ๋ฌธ์— ์‚ฌ์šฉํ•œ๋‹ค.
        * mavenCenteral์— ์˜ฌ๋ฆฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋ฒ„์ „ ์—…๋กœ๋“œ๊ฐ€ ํ•„์š”ํ•  ๋•Œ, jcenter()์ด ํ•„์š”ํ•˜๋‹ค.
        * 2022๋…„ 1์›”๋ถ€ํ„ฐ ๊ฒฐํ•จ ํ•ด๊ฒฐ์„ ์œ„ํ•ด ๋”์ด์ƒ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค.
        * jcenter()์„ maven์œผ๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ํ•ด์•ผํ•œ๋‹ค.
        * */
//        jcenter()
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group 'com.jojoldu.book'
version '1.0-SNAPSHOT'

// ๊ฐ์ข… ์˜์กด์„ฑ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์„ ์–ด๋–ค ์›๊ฒฉ ์ €์žฅ์†Œ์—์„œ ๋ฐ›์„ ๊ฒƒ์ธ์ง€๋ฅผ ์ •ํ•œ๋‹ค.
repositories {
    mavenCentral()
//    jcenter() // ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—…๋กœ๋“œ ๋‚œ์ด๋„ ๋•Œ๋ฌธ์— jcenter๋Š” deprecated
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

test {
    useJUnitPlatform()
}

/* ์™œ ๋‘๋ฒˆ repositories, dependencies์„ ์‚ฌ์šฉํ• ๊นŒ?
buildscipt๋Š” Gradle ์ž์ฒด๋ฅผ ์œ„ํ•œ ์ˆ˜ํ–‰๋ฐฉ๋ฒ•
all projects๋Š” Gradle์—์„œ ๋นŒ๋“œํ•˜๋Š” ๋ชจ๋“ˆ์„ ์œ„ํ•œ ๊ฒƒ 
 */

* ์‹คํ–‰ ํ›„ ๋นŒ๋“œ๋œ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๋Œ“๊ธ€