[build 에러] A problem occurred configuring root project '프로젝트명'. > Could not resolve all files for configuration ':classpath'. > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.3.

hwarye·2024년 3월 13일
0

Trouble Shooting

목록 보기
11/11

에러문

A problem occurred configuring root project 'first'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.3.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.3
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.3 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.6' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 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.6')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.3 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.6')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')

블라블라~
어찌되었던 호환성이 안맞는다는 얘기다.
하나씩 찾아봐야한다.
자바 버전은 무엇인지, spring boot 버전은 무엇인지, gradle 버전은 무엇인지, 인텔리제이 버전은 무엇인지!


만들고자 했던 프로젝트 버전
java21 + spring boot 3.2 + Gradle


확인해야 할 사항

🔶 자바 버전

인텔리제이에서
File > Project Structure > Project Settings > Project > SDK

  1. 자바 21 버전으로 되어 있는지 확인한다.
  2. 다른 버전으로 되어 있다면 21 버전으로 변경한다.
  3. 21 버전이 없다면 Download JDK > Version = 21 로 설정 후 원하는 디렉토리에 원하는 것으로 다운받는다.
  4. Language level 확인
  5. Language level 에 21이 없다면 해당 인텔리제이 버전에서는 21을 지원하지 않는 것이므로 new version의 인텔리제이를 다운로드하여 새로운 버전의 인텔리제이에서 실행한다.
    나의 경우에도 최신 level이 21이 아닌 20으로 떴기에 하단의 링크에서 업데이트된 버전으로 다시 다운받았다! 해당 업데이트 버전의 인텔리제이에서는 language level에 21이 뜬다!
    https://www.jetbrains.com/ko-kr/idea/whatsnew/
    SDK가 21로 설정되어있고 Language level이 SDK default라고 뜨는 경우 21버전의 SDK의 기본값인 java21로 잘 설정된 것이니 넘어가면 된다!

🔶 spring boot 버전

build.gradle 에서 확인해보자!

id 'org.springframework.boot' version '3.2.3' 를 보니 3.2.3 버전인 것을 알 수 있다.
java21 => spring boot 3.2 버전으로 다운받기를 권한다.

🔶 gradle 버전

spring boot 3.2.3 버전을 사용하기 위해선 gradle의 버전이 7.5 이상이 되어야 한다.

  1. 프로젝트 내에서
    gradle > gradle-wrapper.properties > distributionUrl 확인하기
    나의 경우 8.5로 설정되어있는 것을 확인할 수 있다.
  1. MAC : IntelliJ IDEA > Settings > Build,Execution,Deployment > Build Tools > Gradle 확인하기
    Gradle JVM이 java버전과 동일해야 한다.

🔶 intelliJ IDEA 버전

위에서 언급했듯 최신 버전의 인텔리제이가 아니면 java21을 지원하지 않는다.
https://www.jetbrains.com/ko-kr/idea/whatsnew/
2023.3 릴리즈 이전의 버전이라면 새로 다운받아 사용하자!


cf)
https://docs.google.com/document/d/1j0jcJ9EoXMGzwAA2H0b9TOvRtpwlxI5Dtn3sRtuXQas/edit#heading=h.f9xqb7l8nuph

profile
례코드

0개의 댓글