티스토리 뷰

스프링 부트와 AWS로 혼자 구현하는 웹 서비스 라는 책을 보고 배운 것을 정리하는 공간입니다.

그레이들 프로젝트를 스프링 부트 프로젝트로 변경하기

Spring Boot Gradle Plugin를 위한 설정

buildscript {
    ext {
        springBootVersion = '2.1.7.RELEASE'
    }
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
  • ext : build.gradle에서 사용하는 전역변수를 설정하겠다는 의미.
    spring-boot-gradle-plugin라는 스프링 부트 그레이들 플로그인의 2.17 RELEASE를 의존성으로 받겠다는 의미.
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
  • io.spring.dependency-management : Maven과 같은 종속성 관리 기능을 제공하는 Gradle 플러그인이다.
repositories {
    mavenCentral()
    jcenter()
}

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

    testCompile('org.springframework.boot:spring-boot-starter-test')
}
  • repositories : 각종 의존성(라이브러리)들을 어떤 원격 저장소에서 받을 지를 정한다.

mavenCentral() vs. jcenter()

mavenCentral은 본인이 만든 라이브러리를 업로드하기 힘들다.
그렇기 때문에 라이브러리 공유가 안되는 상황이 발생했다.
이런 문제점을 개선하여 라이브러리 업로드를 간단하게 한 jcenter가 나왔다.
  • dependencies : 프로젝트 개발에 필요한 의존성들을 선언하는 곳이다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함