최근 2년정도 IntelliJ에서 Java 11 기반의 AWS Correto 11 을 사용해왔습니다
그래서 현재 JAVA_HOME 은 AWS Correto 11 의 위치를 가리키고 있었습니다.
신규 프로젝트 구성할 일이 생겼고
AWS Correto 17 을 미리 다운받아둔 상태에서
IntelliJ 에서 SpringBoot Initializer 를 이용해서
아래와 같은 설정(Java 17 + gradle groovy)으로 프로젝트를 생성하고
빌드를 하니 오류가 발생했습니다.
아래는 빌드시 발생했던 오류 메시지
A problem occurred configuring root project 'my-new-springboot3-project'.
> 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:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 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 11)
- 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.5')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional: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:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 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 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 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 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 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 11)
- 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.5')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
에러 메시지의 내용을 읽어보니, 일단 Could not resolve xxx 의 경우 xxx 라이브러리가 없다라는 메시지인데
신규 생성한 프로젝트에서 필수라이브러리를 dependency에 안넣을 이유가 없다는 생각이 우선 들었습니다.
그런거라면 springboot initializer 의 버그일테니까요.
그래서 더 읽어봤습니다.
그리고 "requierd compatibility with Java 11" 문구가 눈에 띄었습니다.
난 자바17을 쓰려고 17버전으로 JDK와 Java 설정을 넣었는데 왜 Java 11 관련메시지가 뜨는건지 이상했습니다. 🤔
에러메시지 내용으로 구글링을 좀 해보니 아래 부분들을 확인해보라는 내용들이 있었습니다.
일단 빌드시에 발생했고, 빌드툴은 gradle 이라는 걸 이미 프로젝트 생성시 설정을 해주었고, IntelliJ에 gradle 이 사용할 자바버전을 설정하는 내용이 있다는 것을 알고있었기에 gradle JVM 설정을 먼저 확인해봤습니다.
gradle JVM 설정이 기존 설정 그대로 Java 11을 사용하도록 되어있었습니다. 😭
프로젝트 생성시 correto 17, Java 17 버전을 설정해주었기에 sourceCompatibility 와 project SDK 는 17버전을 사용하도록 되어있었고, JAVA_HOME에 설정되어있는 현재 시스템에서 기본으로 사용중인 Java 버전과는 관계가 없었습니다.
Preferences/Settings (⌘ + , ) > Build, Execution, Deployment > Build Tools > Gradle
File > Project Structure.. (⌘ + ; )
Spock Test Framework 실행 오류 해결 (2) | 2024.01.03 |
---|---|
SpringBoot 2.3 -> 2.5 업그레이드 후기 (0) | 2023.12.29 |
[AWS/SQS] cloudwatch datapoint 조회하기 (2) | 2022.12.29 |
MariaDB로 AWS Aurora 연동시 readOnly 트랜잭션이 writer 쪽에서 실행되는 현상 분석 (0) | 2022.12.26 |
[AWS] redis-cli 를 이용한 elasticache 데이터 조회 (0) | 2022.05.27 |