1. build.gradle
buildScript
- 프로젝트의 플러그인 의존성 정보를 담고 있다.
buildscript{
ext{ //ext : build.gradle에서 사용하는 전역 변수 설정
springBootVersion = '2.1.7.RELEASE'
}
repositories { // 의존성들을 받을 원격 저장소 설정
mavenCentral() // 이전에 자주 사용된 원격 저장소
jcenter() // 최근 자주 사용되는 원격 저장소
}
dependencies { // 의존성을 받을 스프링 부트 플러그인 지정
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply
- 다음 4개의 플러그인은 spring boot 프로젝트를 위한 필수 플러그인이다.
apply plugin: 'java' // 필수
apply plugin: 'eclipse' // 필수
apply plugin: 'org.springframework.boot' // 필수
apply plugin: 'io.spring.dependency-management' // 필수 : 스프링 부트 의존성 관리 코드
기본형
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'
group = 'com.springboot-aws.book'
version = '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
// lombok 사용을 위한 의존성 : Getter, 생성자 자동 생성 어노테이션 지원
compile('org.projectlombok:lombok')
// springboot용 spring data jpa 추상화 라이브러리
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('com.h2database:h2') // h2 : 인메모리 관계형 DB
// mustache 템플릿 엔진을 사용하기 위한 의존성
compile('org.springframework.boot:spring-boot-starter-mustache')
// 소설 로그인 구현 시 필요한 의존성
compile('org.springframework.boot:spring-boot-starter-oauth2-client')
// jdbc를 사용하기 위한 의존성
compile('org.springframework.session:spring-session-jdbc')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
}
test {
useJUnitPlatform()
}
2. application.yml
3.