Web/Spring
[Spring] SpringBoot build.gradle 설정 오류 해결
땀두
2022. 4. 9. 13:27
buildscript {
ext {
springBootVersion = '2.1.9.RELEASE'
}
repositories {
mavenCentral() //jcenter는 mavenCentral로 마이그레이션되었다.
// https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
}
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.jojoldu.book'
version '1.0.4-SNAPSHOT-'+new Date().format("yyyyMMddHHmmss")
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.projectlombok:lombok')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-mustache')
compile('com.h2database:h2')
compile('org.springframework.boot:spring-boot-starter-oauth2-client')
compile('org.springframework.session:spring-session-jdbc')
compile("org.mariadb.jdbc:mariadb-java-client")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile("org.springframework.security:spring-security-test")
}buildscript {
ext {
springBootVersion = '2.1.9.RELEASE'
}
repositories {
mavenCentral() //jcenter는 mavenCentral로 마이그레이션되었다.
// https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
}
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.jojoldu.book'
version '1.0.4-SNAPSHOT-'+new Date().format("yyyyMMddHHmmss")
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.projectlombok:lombok')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-mustache')
compile('com.h2database:h2')
compile('org.springframework.boot:spring-boot-starter-oauth2-client')
compile('org.springframework.session:spring-session-jdbc')
compile("org.mariadb.jdbc:mariadb-java-client")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile("org.springframework.security:spring-security-test")
}
스프링부트와 AWS로 혼자 구현하는 웹 서비스 책을 따라하다 보면 책 처음 프로젝트 생성 후 build.gradle 설정을 아래와 같이 입력 후 gradle을 로딩하게되면 아래와 같은 에러가 발생하게 된다.
문제를 확인해보면 compile이라는 메소드를 찾을 수 없다는 내용인데 이는 gradle 버전의 문제이다.
gradle 7 버전에서는 compile대신 implementation, testCompile 대신 testImplementation을 사용해야 한다.
이 부분을 수정 후 gradle을 리로드하게되면 정상적으로 설정을 끝마칠 수 있다.