프레임워크/스프링 부트

간단한 스프링 부트 3 최초 실행 문제 해결 (Could not resolve org.springframework.boot:spring-boot-gradle-plugin)

Jake Seo 2023. 7. 25. 19:46

에러 발생 경위

  • 스프링 부트로 프로젝트를 생성하려 했다.
  • 최신 버전이 스프링 부트 3.0 으로 프로젝트를 생성하니 켜자마자 에러가 발생했다.

에러 내용

A problem occurred configuring root project 'adhdprotector'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1')

에러 해결

  • 에러 내용이 방대한데 자세히 읽어보면, 아래와 같은 메세지가 존재한다.
- 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
  • 자바 17 버전과 호환된다고 적혀있다.

의문점

  • '나는 이미 자바 17 깔려 있고 쓰고 있는데? 라고 생각했다.'
  • 문제는 gradle 을 빌드하는 자바 버전을 수정해야 했다.

완전 해결

  • Preferences 메뉴로 접근해서 'build' 라는 키워드로 검색하고 Gradle JVM 버전을 바꿔주니 잘 된다.

picture 1

반응형