에러 해결

SpringBoot 3.X 인텔리제이 켜자마자 에러가 발생했을 때 해결 법

데부한 2023. 6. 13. 20:44
반응형

진리의 검빨

 

새로운 프로젝트를 실행해보고자 git에서 팀원이 올려놓은 프로젝트를 받아서 실행해보려 했는데 켜자마자 기다렸다는 듯이 에러가 우수수 떨어졌다.

A problem occurred configuring root project 'tooit'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.0.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.0
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.0 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6.1' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
반응형

에러 내용 중에 Java가 있어서 Java 버전 문제인 거 같다는 생각이 들었다. 근데 나 3.X 버전대로 이미 다른 프로젝트를 실행해본 적이 있는데....? 일단 스프링부트 3.X 버전부터는 고대에서부터 내려오던 Java 8 버전이나 11을 쓰지 못하고 17부터 사용할 수가 있다. 

그래도 혹시 모르니까 Java 버전을 확인해보긴 해보자.

무려 17도 아니고 19다!

 

Java가 17 버전 미만으로 깔려있지도 않은데..? 

혹시 팀원이 start.spring.io/ 에서 프로젝트를 생성할 때 Java 버전을 잘못 선택했나 싶어 build.gradle에도 방문해봤다.

의심해서 미안해

 

 

이제 마지막으로 인텔리제이 설정을 살펴보자. 검색창에 build 검색 후 

Build, Exeution, Deployment > Build Tools > Gradle 메뉴로 이동해보자.

반응형

 

허 저기 떡하니 17이 아닌 11이 선택되어있다.

 

JDK 버전을 17로 변경해주었다.

반응형

 

그리고 인텔리제이를 재실행하면 에러 없이 잘 로드 된다!

 

정리!

인텔리제이로 스프링부트 3.X 버전이 로드 되지 않을 땐

1. 로컬에 설치된 Java 버전 확인

2. build.gradle Java 버전 확인

3. 인텔리제이 설정 확인

이 순서대로 확인해보면 된다.

반응형