스프링 부트 강의를 따라하다 초기 부트 설정에서 다음과 같은 오류가 발생했다:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'helloboot_02'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.9.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.9
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.9 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.2.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.9 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:
...
...
...
...
CONFIGURE FAILED in 38s
해석은 다음과 같은 요소들에 매치되는 스프링부트 플러그인을 찾을 수 없다는 것이다.
원인은 Java 버전 문제였다.
나는 Java 11로 Spring Boot 3.x번대를 설정하려다 위 오류가 발생하였다.
https://spring.io/blog/2022/05/24/preparing-for-spring-boot-3-0
Preparing for Spring Boot 3.0
Spring Boot 2.0 was the first release in the 2.x line and was published on Feburary 28th 2018. We’ve just released Spring Boot 2.7 which means that, so far, we’ve been maintaining the 2.x line for just over 4 years. In total we’ve published 95 distin
spring.io
Upgrade to Java 17
Spring Boot 3.0 will require Java 17, but you don’t need to wait until that release to upgrade to the latest LTS Java version. Any recent Spring Boot 2.x release will work really well with Java 17. You can also make use of Java 17 features (such as records) in your own codebases.
We highly recommend that you upgrade your JDK today if at all possible.
공식 문서에 의하면 3.0부터 Java 17버전이 요구된다.
IDE를 사용중이라면 보다 더 편리하게 17로 변경해보자.
나는 사실 강의에서 2.7로 하라했지만 무의식적으로 3번대가 땡겨서 하다 다음과 같은 실수를 범하였다.
'dev > spring' 카테고리의 다른 글
[Spring] 라이브러리를 추가했는데, 인식이 안되는 경우? (1) | 2024.10.04 |
---|---|
[스프링부트] 환경설정부터 로그인과 CRUD 기능 구현 (1/2) (0) | 2023.08.13 |