[Spring Boot | Error] No matching variant of org.springframework.boot :spring-boot-gradle-plugin:3.2.2 was found...

2024. 5. 17. 13:57·Spring & SpringBoot

Spring boot 3.2.2 버전으로 스프링 부트 프로젝트를 생성해서 실행해보니 처음에 이런 에러가 발생했다.

 

원래는 Java 11을 사용하고 있었는데 Spring boot 3.x 버전부터는 Java 17 버전 이상을 지원하기 때문에, Java 21 버전을 새로 설치한 후 실행했는데도 똑같은 에러가 발생했다.

에러 코드를 보면 Java 17, Java11이 나와서 자바 버전의 문제인가 싶어서 자바 버전을 확인해보았다.

 

전체 에러 코드

A problem occurred configuring root project 'hello-srping'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.2.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.2
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.2 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.5')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.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.5')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.2 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.5')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.2 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.5')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.2 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.5')

 

 

 

 

 

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

   cmd에서 현재 설치된 자바 버전을 확인한다.

 

 

 

2. build.gradle Java 버전 확인

해당 프로젝트의 build.gradle 에서 soureCompatibility 를 확인한다.

(start.spring.io/ 에서 프로젝트를 생성할 때, Java 버전을 잘못 선택해서 생성했는지 확인)

 

 

 

3. 인텔리제이 설정 확인

위의 1, 2 를 확인해도 문제가 없다면, 인텔리제이 설정을 확인한다.

Settings > Build,Execution, Deployment > Gradle > Gradle JVM

Gradle JVM이 21이 아닌 11로 선택되어 있었다.

JDK 21로 변경해주고 인텔리제이를 재실행하면 에러없이 잘 동작한다.

저작자표시 비영리 변경금지 (새창열림)

'Spring & SpringBoot' 카테고리의 다른 글

[Spring] 윈도우 cmd에서 Spring 프로젝트 빌드하고 실행하기  (0) 2024.03.26
[Spring] Spring Initializr 사용법  (0) 2024.03.24
'Spring & SpringBoot' 카테고리의 다른 글
  • [Spring] 윈도우 cmd에서 Spring 프로젝트 빌드하고 실행하기
  • [Spring] Spring Initializr 사용법
nyrimmm
nyrimmm
  • nyrimmm
    개발기록
    nyrimmm
  • 전체
    오늘
    어제
  • 글쓰기 관리
    • 분류 전체보기 (69)
      • Java (6)
      • Spring & SpringBoot (3)
      • Network (1)
      • DataBase (0)
      • SQL (1)
      • IntelliJ (3)
      • Git (0)
      • 자료구조 & 알고리즘 (2)
      • 트러블 슈팅 (1)
        • Spring (1)
      • PS (51)
        • 백준 (11)
        • 프로그래머스 (0)
        • SQL (9)
        • 이코테 (31)
      • 후기 & 회고 (1)
  • 태그

  • 인기 글

  • 최근 글

  • 최근 댓글

  • hELLO· Designed By정상우.v4.10.3
nyrimmm
[Spring Boot | Error] No matching variant of org.springframework.boot :spring-boot-gradle-plugin:3.2.2 was found...
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.