Spring Boot 버전과 Java 버전 및 설치

onebbu·2023년 8월 29일
0

자바 Spring_기본

목록 보기
1/1

인프런에서 스프링 공부 중 스프링 부트 프로젝트를 설치하고 인텔리제이에서 오픈했을 때 아래와 같은 에러가 발생했었다.

아래는 에러 메세지 일부

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

오류메세지를 구글링해보니 Spring Boot 버전에 따라 Java 버전을 다르게 사용해야 하는 것을 확인했다.
현재 Spring Framework에서는 자바 17이상의 버전을 사용해야한다.(6.0.11 버전 기준)

또한 인프런에서 검색해보니 스프링 부트 3.x 버전에서는 Java 17이상 버전을, 2.x버전에서는 Java 11을 쓰면 될 것 같다.

자바 11버전과 17버전의 차이

  1. Java 서포트 기간이 길다. (LTS)
  2. 신규 버전을 위한 대비용으로 도입. (java 8에서 바로 최신버전을 쓰려고 할 때보다 마이그레이션이 수월할 것으로 예상)
  3. Spring Boot 3.0 부터는 자바 17 이상을 지원

스프링 부트 초심자 입장에서 계속해서 배워나가기 위해 최신 버전으로 공부해야겠다.

자바 17버전 설치 및 인텔리제이 프로젝트 오픈

참고 링크

Reference
스프링 공식 문서
인프런 Q&A 참고
Jeongkuk Seo님 블로그
자바 11버전 vs 17버전
인텔리제이 자바 17버전

profile
느리지만 조금씩 발전해가기

0개의 댓글