테스트 환경 및 주요 아젠다
스프링 프로젝트를 로드하는 과정에서 Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.x.x 오류가 발생합니다.
Gradle에서 다음 오류 로그가 출력되며 스프링 프레임워크 플러그인을 로드하지 못합니다.
A problem occurred configuring root project 'demo'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.5.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.5
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.5 was found. The consumer was configured to find a library for use during runtime, compatible with Java 12, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.5 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 12
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.5 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 12)
- 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.4')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.5 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 12
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.5 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 12
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.5 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 12
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.5 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 12)
- 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.4')
더보기
이 프로젝트의 개발 환경
- Spring Framework
- spring-boot-gradle-plugin:3.1.5
- JDK(Java Development Kit)
- OpenJDK 17 버전
- IDE(Integrated Development Kit)
- IntelliJ IDEA 2023.3(Ulitimated Edition)
Step 1: 자바 버전 확인
스프링 부트 3.0부터는 JDK 17버전 이상을 필요로합니다.
$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 17.0.9+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.9+0, mixed mode, sharing)
스프링에서 요구하는 자바 버전을 만족하지 못하였다면 자바를 설치하고 다음 단계를 진행합니다.
Step 2: Gradle 파일 확인
JDK 17버전 이상이 설치되어 있다면 프로젝트의 build.gradle 파일을 확인합니다.
sourceCompatibility가 17 이상으로 설정되어 있어야합니다.
java {
sourceCompatibility = '17'
}
Step 3: IntelliJ IDEA 프로젝트 설정 확인
IntelliJ에서 File | Project Structure | Project Settings | Project 경로로 입장합니다.
Project SDK에서 JDK 17버전 이상이 선택되어 있는지 확인합니다.
IntelliJ에서 Settings or Preferences | Build, Execution, Deployment | Build Tools | Gradle 경로로 입장합니다.
Gradle JVM에서 JDK 17버전 이상이 선택되어 있는지 확인합니다.
정리 및 복습
- 스프링 부트 3.0부터는 JDK 17버전 이상을 요구합니다.
java -version으로 자바 설치 버전을 확인합니다.- build.gradle에서
sourceCompatibility프로퍼티를 확인합니다. - 프로젝트 설정에서
Project SDK및Gradle JVM버전을 확인합니다.
'Java > Spring' 카테고리의 다른 글
Spring.io 따라하기: RESTful 웹 서비스에 요청하기 (0) | 2023.11.22 |
---|---|
Spring 5 입문: Chapter 02B. 예제 코드로 Spring 시작하기 (0) | 2023.11.21 |
Spring.io 따라하기: RESTful 웹 서비스 구현하기 (0) | 2023.11.20 |
Spring 5 입문: Chapter 02A. 스프링 프로젝트 시작하기 (0) | 2023.11.17 |
Spring.io 따라하기: Quickstart (0) | 2023.11.07 |