https://start.spring.io/에서 최신 스프링 부트를 그래들로 다운받았는데 import 에러가 났는데 뭔말인지 모르겠다 알면 적어주시면 가사하겠습니다. 찾다보니가 gradle 버전을 낮춰졌더니 성공했다. (내 gradle 버전 7.2)
Unable to find method 'org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()Ljava/lang/String;'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>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)</li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
무슨 오류인가?
Unable to find method ''java.lang.String org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()''.
IntelliJ가 추천해줬던 해결 방법
- Reimport를 시도해라.
- Gradle을 다시 설치하거나, 다시 시작해라. (IntelliJ 재부팅)
보통 1번의 방법으로 해결되는 경우가 많다. 이에 관해서는 jojoldu님의 블로그에 자세하게 설명되어 있다.
https://jojoldu.tistory.com/364
IntelliJ에서 Gradle 프로젝트 작동안될때
간혹 Gradle 프로젝트를 IntelliJ에서 불러올때 Gradle이 정상작동하지 않을때가 있습니다. 전혀 코드가 작동하지 않는데요. 이럴때 2가지 해결방법이 있습니다. 1. Import Gradle Project 먼저 IntelliJ 우측
jojoldu.tistory.com
경험 상, 90%의 문제는 이 방법으로 해결이 가능하다. 이 방법을 시도했음에도 안되는 상황이 있다면, 2번을 고려해야 한다.
2번의 해결 방법을 시도해야 하는 상황이 오면, 대부분 해결이 안 된다.
이건 gradle의 버전 문제거나, gradle 자체가 문제가 있어서 IntelliJ가 이런 처방을 내려준다. 이렇게 IntelliJ가 자동으로 설치해주는 gradle을 설치하고 이걸 재시작한다고 해결할 수 있는 경우는 거의 없다. 이때는 gradle 버전을 직접 변경해줘야 하는데, 다음 경로에서 버전을 확인할 수 있다.
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
gradle-wrapper.properties의 설정을 보면, distributionUrl에 해당 프로젝트에서 사용하는 gradle 버전을 볼 수 있다. 내 경우, 새로운 프로젝트를 생성하고 import를 하려고 할 때 문제가 발생했는데, 7.x.x 버전에 문제가 있었고, 이전에 학습하던 프로젝트는 문제가 없었다. 그래서 정상적으로 동작하던 6.8.3으로 변경하고 다시 시도를 해보니 정상적으로 동작했다.
import 성공!
정상적으로 gradle을 빌드했으니 이제 다시 열심히 프로젝트를 작성하면 된다!
출처: https://twinparadox.tistory.com/624 [Twinparadox Factory]
출처: https://twinparadox.tistory.com/624 [Twinparadox Factory]
'에디터 > IntelliJ' 카테고리의 다른 글
[IntelliJ] JAVA 버전 바꾸는 방법(JDK버전) (0) | 2022.10.05 |
---|---|
인텔리제이 중복코드 노란줄 없애기 (0) | 2021.09.30 |
인텔리제이 커스텀 예약어 생성 (0) | 2021.08.22 |
인텔리제이 JPA 설정 (0) | 2021.08.21 |
인텔리제이 lombok 설치 (0) | 2021.08.13 |