Springboot에서 새로운 라이브러리 추가를 위해 compile명령어를 사용해야 합니다. 라이브러리를 다운로드하기 위해 gradle에서 명령어를 실행하면 Could not find method compile()이라는 오류가 발생합니다.
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
compile('org.projectlombok:lombok')
}
오류 원인
Gradle 버전에 따라 지원하는 명령어 차이가 있습니다.
Gradle 7.0버전 이전에는 dependencies에서 complie, testComplie, runtime이라는 명령어가 사용되고 있었습니다.
Gradle 7.0버전 이후 해당 명령어들은 삭제되어 아래 명령어로 대체되었습니다.
compile -> implementation
testComplie -> testImplementation
runtime -> runtimeOnly
현재 프로젝트에서 사용중인 Gradle 버전은 7.5이므로 dependencies에서 아래와 같이 변경하였습니다.
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
implementation('org.projectlombok:lombok')
}
반응형
'프로그래밍 > Java' 카테고리의 다른 글
[Spring Boot] 알아두면 편리한 Annotation 사용 및 정리 (0) | 2023.04.11 |
---|---|
[SpringBoot] lombok error variable not initialized in the default constructor 해결 방법 (0) | 2023.03.23 |
댓글