본문 바로가기

IT프로그래밍/Spring

[Spring]Intellij Gradle 세팅 Unable to find method 오류 해결하기

인텔리제이에서 Spring Boot 프로젝트를 Gradle 기반으로 생성 했을 때 아래 이미지 처럼

Unable to find method 에러를 뿜는 경우가 있습니다.

 

인텔리제이 gradle 관련 에러

개발환경

제가 사용한 개발환경은

1. IntelliJ 2019.3.5 버전

2. JDK 8 버전

3. gradle 7.4.1 버전

이었고,

스프링 부트 프로젝트 생성 후, 프로젝트를 생성하자마자 에러가 뿜어져 나왔습니다..(억울;;)

 

Unable to find method 'org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()Ljava/lang/String;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

위 에러와 관련하여

IntelliJ에서 제공하는 해결법인

Re-download dependencies and sync project (requires network)를 클릭하거나

Stop Gradle build processes (requires restart) 를 클릭해도 

해결되지 않았습니다.

 


 

 

Gradle Unable to find method 해결방법

gradle-wrapper.properties 경로

1. 프로젝트 폴더에서 gradle\wrapper\gradle-wrapper.properties를 더블클릭합니다.

(.gradle 아님 주의)

 

gradle 버전 확인

distributionUrl의 제일 끝부분에 gradle의 버전이 명시되어 있습니다.

 

2. gradle의 버전을 변경하여 줍니다.

gradle의 버전은

https://gradle.org/releases/

 

Gradle | Releases

Find binaries and reference documentation for current and past versions of Gradle.

gradle.org

에서 확인 할 수 있었습니다.

 

 

저는 gradle을 6.8.3 버전으로 변경하였습니다.

 

변경 방법은 gradle-wrapper.properties에 7.4.1이라고 써있던 것을 지우고6.8.3을 입력하면 됩니다.

gradle 버전 변경

버전 변경 후

 

3. IntelliJ에서 Gradle을 Reimport 해야 합니다.

인텔리제이 오른쪽에 보면 gradle의 마스코트인 코끼리 모양이 보입니다.

누릅니다.

Gradle 관련 창이 나오면 새로고침 아이콘처럼 생긴 Reimport All Gradle Projects 버튼을 누릅니다.

Reimport All gradle Projects

 

4. Build창에 다음과 같은 메시지가 나오면 성공입니다 !