Search

배포하는 과정중에 Spring Project를 build과정중에 오류가 생겼습니다.

태그

Description

plugins { id 'java' id 'org.springframework.boot' version '2.7.9' id 'io.spring.dependency-management' version '1.0.15.RELEASE' } group = 'com.jgj' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() // maven { url 'https://repo.spring.io/milestone' } // maven { url 'https://repo.spring.io/snapshot' } } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis implementation 'org.springframework.boot:spring-boot-starter-data-redis' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' } tasks.named('test') { useJUnitPlatform() } tasks.named<Jar>("jar") { enabled = false }
JSON
복사
현재 build.gradle 파일입니다.
오후 9:09:20: 실행 중 'build'... FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'byl_process'. > Could not open cp_proj generic class cache for build file 'F:\JoGuangJo-Back\build.gradle' (C:\Users\d9801\.gradle\caches\7.6.1\scripts\4lbasw7wkhbr50dqfw8nkdkfu). > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64 * 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 93ms 오후 9:09:20: 실행이 완료되었습니다 'build'.
JSON
복사
오류 코드 전문입니다.

Try

일전에 비슷한 오류가 있던걸로 기억합니다.
tasks.named<Jar>("jar") { enabled = false } // 이 코드는 코틀린 코드라고 합니다. tasks.named("jar") { enabled = false } // <> 를 제거하고 다시 실행해도 같은 오류가 발생합니다.
JSON
복사
지금 확인해보니 프로젝트를 다시 로드 하는 작업도 안 되는것 같네요 Gradle 자체의 문제 같습니다.
현재 사용하는 자바 버전은 11인데 Gradle의 버전은 20을 잡고 있었습니다. 변경해주겠습니다.

Solution

여기서 gradle의 jvm이 Java 20을 잡고 있었습니다. 현재 사용하는 11 버전으로 바꿔줍니다.
해결되었습니다.