오류해결

스프링부트 3.x에서 자바11 라이브러리 찾으려는 오류

indeep 2023. 12. 15. 00:58

스프링부트 3 버전을 사용하면서 이전 프로젝트를 실행시키는데 아래와 같은 에러가 발생했다.

 

Required by: project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.0 Caused by: org.gradle.internal.component.NoMatchingGraphVariantsException: No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.0 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.0 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

 

즉 런타임에서 자바11과 호환되는 라이브러리를 찾는다는 내용인데 yml에도 17을 사용하도록 명시해놨는데

문제는 다른 곳에서 해결할 수 있었다.

 

설정에서 Gradle 부분에 JVM 버전이 11로 설정돼있었다.

Gradle을 실행할 때 지금은 9.0에 스프링부트 3.x 버전인데 자바 JDK를 11로 해놓으니 문제가 발생한 것

이걸 17로 바꿔주니 정상 빌드가 됐다!

반응형