build.gradle

오젼·2024년 5월 12일
0

build.gradle

스프링으로 작성한 코드를 빌드할 때

프로젝트 디렉토리에서 ./gradlew build 를 사용.

이 때 build.gradle 파일에 정의한 내용을 기준으로 빌드가 된다.

dependencies

의존성 추가 implementation 구문으로 사용

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.rest-assured:rest-assured:5.3.1'
}

spring-boot-starter vs spring-boot-starter-web

spring-boot-starter는 Spring Boot 애플리케이션을 개발하는 데 필요한 핵심 라이브러리와 설정을 포함하는 메타 의존성.

spring-boot-starter-webspring-boot-starter 확장버전. 웹 애플리케이션을 개발하기 위한 추가 기능이 포함됨.

그래서 spring-boot-starter-web을 implementation 했다면 spring-boot-starter는 implementation 안 해도 됨.

+) 데이터베이스 관련 개발을 하고 싶다면 spring-boot-starter-data-jpa를 사용. 이건 spring-boot-starter에 데이터베이스 관련 추가 기능이 포함된 라이브러리.

testImplementation

프로덕션 코드에 사용되지 않고 테스트 코드에만 사용되는 라이브러리들을 추가할 수 있게 하기 위한 의존성 구문

0개의 댓글