🟦 기본 환경: IDE: IntelliJ, Language: Java
발생 Error
SpringBoot에서 SpringBoot 3.x대 project import 시, 🚨 다음과 같은 Error 발생
A problem occurred configuring root project 'NewProject'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.0.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.0
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.0 was found.
The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally,
as well as attribute 'org.gradle.plugin.api-version' with value '7.6.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
발생 원인
SpringBoot 3.0 부터는 Java 17부터 지원
해결 방법
1. SpringBoot를 2.x대로 다운그레이드
2. Java17 설치
2.1. File / Settings / Build, Execution, Deployment / Build Tools / Gradle
: Gradle JVM: Java17 이상으로 설정
2.2. File / Project Structure / Project
: SDK - Java 17 이상으로 설정
: Language level - SDK default로 설정
2.3. File / Project Structure / Modules
: Language level - project default로 설정
2.4. Gradle Refresh
참고 자료
'Java > Spring with Error' 카테고리의 다른 글
[해결 방법] import org.springframework cannot be resolved (0) | 2023.05.30 |
---|---|
[해결 방법] Whitelabel Error Page (0) | 2023.05.30 |
[해결 방법] Request method 'POST' not supported (0) | 2023.05.28 |
[해결 방법] org.springframework.validation.BindException: (0) | 2023.05.27 |
[해결 방법] Unable to create requested service (0) | 2023.05.25 |