본문 바로가기
개발일지/스프링부트, AWS 웹서비스

build.gradle 바뀐 표기법

by -제이리 2022. 11. 29.
728x90
320x100

스트링부트와 AWS로 혼자 구현하는 웹 서비스(이동욱 저자)를 보며 실습을 하고 있다.

아직 생소한 단어들도 있고, 지금껏 VS studio만 써왔는데 새로운 IDE인 인텔리제이를 사용해보게 되었다.

요즘 자바를 공부하느라 이클립스를 살짝 사용해봤는데 확실히 인텔리제이 GUI가 이클립스보다 훨씬 낫다.

비쥬얼스튜디오도 인텔리제이로 만들어졌다고 한다. 그래서 더 익숙하게 느껴지는 부분도 있는것 같다.

 

다만 책이 출간이 된지 3년이 지나다보니 버전문제가 조금 있었다. Chapter01 의 build.gradle 작성부터 달라진 부분이 좀 있었다.

 

기존코드에는 buildscript와 apply plugin부분이 나뉘어져 있지만 개선되면서 plugins안에 기존apply plugin과 ext가 들어가게되었다.

그러면서 id와 version을 한 줄에 적는다. 이 방식은 그래이들 4.3버전 이후로 적용되었다.

 

이전 표기법

buildscript {
    ext {
        springBootVersion = '2.1.7.RELEASE'
    }

    repositories {
        mavenCentral()
        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'

 

바뀐 표기법

plugins {
    id 'java'
    id 'eclipse'
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
}

 

또한 dependencies부분도 바뀌었다.

copile->implementation 로 바꿔 작성해야한다.

 

이전 표기

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

 

바뀐표기

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}
728x90
320x100

'개발일지 > 스프링부트, AWS 웹서비스' 카테고리의 다른 글

intellij git 단축키  (0) 2022.11.30

댓글