스터디를 통해 스프링부트와 AWS로 혼자 구현하는 웹 서비스(저자 이동욱) 서적을 공부하는 중입니다.
공부/실습한 내용을 정리한 포스팅입니다.
책에 모르는 부분이 있으면 구글링하거나 챗gpt에 물어봐서 보충하였습니다.
(아직 초보라 모르는 부분이 많아 이것저것 다 적었습니다.)
참고한 사이트 출처는 포스팅 맨 하단에 적었습니다.
buildscript {
ext{
springBootVersion = '2.1.7.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies{
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
스프링부트 그레이들 플러그인 의존성 관리를 위한 설정 코드
buildscript
ext
repositories
mavenCentral
을 많이 사용하지만, 최근에는 라이브러리 업로드 난이도 때문에jcenter
도 많이 사용.mavenCentral
은 본인이 만든 라이브러리를 업로드하기 위해 많은 설정과 과정이 필요하여 개발자들이 업로드를 안하기 시작. jcenter
의 경우, 이런 문제점을 개선하여 라이브러리 업로드를 간단히 하였고 업로드 시 mavenCentral
에도 업로드될 수 있도록 함.dependencies
buildscript
에서는 classpath
사용.org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}
: 플러그인 의존성 관리. ${springBootVersion}
를 통해 플러그인 버전 관리할 수 있음.apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'eclipse'
는 Eclipse IDE와의 통합을 위한 설정을 제공.apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
spring-boot-gradle-plugin
를 추가.plugin
io.spring.dependency-management
: 스프링 부트의 의존성 관리해 주는 플러그인group 'com.webservice.springboot'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
group
version
sourceCompatibility
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
repositories
dependencies
buildscript
의 dependencies
와 달리 classpath
가 아닌 implementation
사용하며 명시된 상황에서만 의존 라이브러리 참조 가능.(implementation이 명시된 상황이며, 사용 시 컴파일 필요)compile
, testCompile
이라 적혀있지만, 삭제된 메서드라 implementation
, testImplementation
사용.참고한 책과 사이트
잘 읽었습니다. 좋은 정보 감사드립니다.