증상
BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
원인
- JDK 와 Gradle 버전 호환 문제
버전확인
PS D:\> gradle -v
------------------------------------------------------------
Gradle 8.0.2
------------------------------------------------------------
Build time: 2023-03-03 16:41:37 UTC
Revision: 7d6581558e226a580d91d399f7dfb9e3095c2b1d
Kotlin: 1.8.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 21.0.5 (Amazon.com Inc. 21.0.5+11-LTS)
OS: Windows 11 10.0 amd64
PS D:\> java --version
openjdk 21.0.5 2024-10-15 LTS
OpenJDK Runtime Environment Corretto-21.0.5.11.1 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.5.11.1 (build 21.0.5+11-LTS, mixed mode, sharing)
해결
호환성확인
Java LTS
| Java version | Support for toolchains | Support for running Gradle |
| 8 | N/A | 2.0 |
| 11 | N/A | 5.0 |
| 17 | 7.3 | 7.3 |
| 21 | 8.4 | 8.5 |
Java LTS support Gradle과 대응되는 Kotlin
| Embedded Kotlin version | Minimum Gradle version | Kotlin Language version |
| 1.3.10 | 5.0 | 1.3 |
| 1.5.31 | 7.3 | 1.4 |
| 1.9.20 | 8.5 | 1.8 |
확인
PS D:\> gradle -v
Welcome to Gradle 8.5!
Here are the highlights of this release:
- Support for running on Java 21
- Faster first use with Kotlin DSL
- Improved error and warning messages
For more details see https://docs.gradle.org/8.5/release-notes.html
------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------
Build time: 2023-11-29 14:08:57 UTC
Revision: 28aca86a7180baa17117e0e5ba01d8ea9feca598
Kotlin: 1.9.20
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21.0.5 (Amazon.com Inc. 21.0.5+11-LTS)
OS: Windows 11 10.0 amd64
PS D:\test> gradle build
Starting a Gradle Daemon, 4 incompatible Daemons could not be reused, use --status for details
> Task :buildEnvironment
------------------------------------------------------------
Root project 'test'
------------------------------------------------------------
classpath
No dependencies
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed

https://docs.gradle.org/current/userguide/compatibility.html
Compatibility Matrix
Gradle runs on the Java Virtual Machine (JVM), which is often provided by either a JDK or JRE. A JVM version between 8 and 23 is required to execute Gradle. JVM 24 and later versions are not yet supported. Executing the Gradle daemon with JVM 16 or earlier
docs.gradle.org
728x90
'개발 > java' 카테고리의 다른 글
| jib (2) | 2024.12.26 |
|---|---|
| openjdk 12 ~ 21 feature (3) | 2024.11.15 |
| spring cloud task (1) | 2024.11.14 |
| jasypt (1) | 2024.11.13 |
| @Aspect로 공통header 처리 (2) | 2024.02.19 |