스프링 부트는 그레이들과 메이븐 빌드 플러그인을 제공한다. 코드 2-3은 Spring Initializr가 만든 스프링 부트 그레이들 플러그인을 적용한 build.gradle 파일이다.
코드 2-3 스프링 부트 그레이들 플러그인 사용
buildscript {
ext {
springBootVersion=‘1.3.6.RELEASE‘
}
repositories {
mavenCentral()
}
dependencies {
classpath(“org.springframework.boot:spring-boot-gradle-plugin:
${springBootVersion}”) // 스프링 부트 플러그인 의존성
}
}
apply plugin: ‘java‘
apply plugin: ‘eclipse‘
apply plugin: ‘spring-boot‘ // 스프링 부트 플러그인 적용
jar {
baseName=‘readinglist‘
version=‘0.0.1-SNAPSHOT‘
}
sourceCompatibility=1.8
targetCompatibility=1.8
repositories {
mavenCentral()
}
dependencies {
compile(‘org.springframework.boot:spring-boot-starter-data-jpa‘) // 스타터 의존성
compile(‘org.springframework.boot:spring-boot-starter-thymeleaf‘)
compile(‘org.springframework.boot:spring-boot-starter-web‘)
runtime(‘com.h2database:h2‘)
testCompile(‘org.springframework.boot:spring-boot-starter-test‘)
}
eclipse {
classpath {
containers.remove(‘org.eclipse.jdt.launching.JRE_CONTAINER‘)
containers ‘org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8‘
}
}