Sprint boot Build error : version 3은 Java11을 지원하지 않는다.

오랜만에 Spring Boot initilizer(https://start.spring.io/) 부터 해서 처음부터 쌓아올리는 공부를 해보려고

필요한 베이스 조건을 체크하고 generate후에 패키지를 열어 빌드를 했다.

그런데, 다음 에러를 마주했다.

A problem occurred configuring root project 'start'.
> 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 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.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:

 

느낌이 java 버전에 문제가 있는데, 실제로 처음에 java version을 체크할때 17로 선택해서 이다. (11이 없어서 일단 17로 했다.)

 

찾아보니 Spring Boot version2가 23년 11월 24일 이후 종료되었고, 이제 3부터 사용할 수 있는데 3부터는 java11은 지원하지 않는다.

 

하지만, 대부분의 회사에서 8 또는 11을 쓰고 그 이하 버전도 많이 쓰고 있는 것으로 알고 있다.

따라서, 이를 해결하기 위해 아래 처럼 build.gradle 파일에서 직접 spring boot version을 2.6.2, java는 11로 바꿔서 해결했다.

 

다음으로

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. 

는 setting에서 build and run using과 run tests using을 intellij IDEA로 변경해주면 된다.

'spring boot' 카테고리의 다른 글

spring boot 입문 -2  (1) 2022.07.03
spring boot 입문 -1  (0) 2022.07.03