Framework/Spring

[Spring Boot] Gradle 빌드 에러 해결하기

Jonnie 2022. 3. 14. 00:39

'스프링 부트와 AWS로 혼자 구현하는 웹 서비스'로 공부하던 중 아래와 같은 에러가 발생하며 빌드가 되지 않았다

 

A problem occurred evaluating root project 'springboot'.
> Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-web] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

 

Gradle 버전의 문제로 책의 코드 중

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

이 부분을

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

이렇게 고쳐주면 된다.

 

compile → implementation

testCompile → testImplementation

'Framework > Spring' 카테고리의 다른 글

[Spring Boot] Lombok - Gradle, jdk 버전 충돌 오류 해결  (0) 2022.03.14