Java/오류노트

[Java/오류노트] Solved - No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.1 was found.

adjh54 2023. 12. 29. 10:31
728x170
해당 글에서는 Spring Boot 프로젝트를 새로 구성하고 빌드하는 과정에서 발생하는 오류에 대해서 확인하고 해결하는 방법에 대해 알아봅니다.





1) 문제점


💡 문제점

- 해당 문제가 발생하는 환경은 Spring Boot 3.2.1 버전을 최초 생성하여 서버를 빌드하는 과정에서 Gradle에서 발생하는 문제로 아래와 같은 문제점이 발생하였습니다.

- 해당 문제점을 확인해보면 프로젝트의 구성이 java 8로 구성이 되어 있어서 java 17로 변경을 하는것을 권장한다는 문제였습니다.

 

> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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 8)
                  - 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.5')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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 8)
                  - 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.5')

 

💡 실제로 공식사이트를 확인해 보면 Spring Boot 3.2.1 버전의 경우 최소 Java 버전을 17로 요구되고 있습니다.

 

Getting Started

If you are getting started with Spring Boot, or “Spring” in general, start by reading this section. It answers the basic “what?”, “how?” and “why?” questions. It includes an introduction to Spring Boot, along with installation instructions.

docs.spring.io

 

 

 

 

2) 해결방법


 

 💡 해결방법

- 이를 해결하기 위해 java 8 버전을 java 17 버전으로 변경하는 작업을 수행합니다.

 

 

1. File - Project Structure.. 를 선택합니다.


 

 

 

2. Project Settings - Project 탭에서 ‘SDK’와 ‘Language level‘ 를 변경해줍니다.


 

 

💡 아래와 같이 변경해주었습니다.

 

 

 

3. 아래와 같이 잘 수행됨을 확인하였습니다.


 

 

 

4. 만약 그래도 안된다면 아래의 글을 참고하셔서 전체적인 JDK 설정을 수행하시면 해결됩니다.


 

 

[IntelliJ] IntelliJ에서 JDK 버전 변경 방법

해당 글에서는 IntelliJ 내에서 JDK 버전을 변경하는 방법에 대해 알아봅니다. 1) IntelliJ에서 JDK 변경 목적 💡 IntelliJ에서 JDK 변경 목적 - IntelliJ에서 JDK를 따로 지정해주어야 하는 이유는 IntelliJ가 사

adjh54.tistory.com

 

 

 

💡 [참고] JDK와 관련되어 아래의 글들을 참고하시면 도움이 됩니다
주제 링크
JDK, Open JDK 이해하기 https://adjh54.tistory.com/213
IntelliJ에서 프로젝트 JDK 버전 변경방법 https://adjh54.tistory.com/355
MacOS에서 Java JDK 설정 및 변경방법 https://adjh54.tistory.com/216
Gradle 버전 확인 및 변경방법 https://adjh54.tistory.com/214

 

 

 

 

오늘도 감사합니다. 😀

 

 

 

그리드형