개발 공부 기록

A problem occurred configuring root project 'project_name' 본문

Spring/Trouble Shooting

A problem occurred configuring root project 'project_name'

나만없서고냥이 2023. 8. 9. 01:33

🚨 문제 발생

더보기

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

 

위와 같이 프로젝트 생성 시 빌드가 되지 않는 오류가 발생하였습니다. 

 

 

💡 문제 원인

사용하려는 플러그인의 버전(3.1.2)은 Java 17을 위해 설계되었지만, 해당 프로젝트는 런타임에 Java 11을 사용하도록 설정되어 있어 이러한 불일치 때문에 오류가 발생하였습니다.

 

🔨 문제 해결

File > Settings > Build, Execution, Deployment > Build Toold > Gradle에서 Gradle Projects의 Gradle JVM을 java 17로 설정합니다. (저는 11로 되어있었습니다..)

OK를 누르고 다시 build를 해줍니다.