오류해결 과정에서의 sts4, java, gradle 버전들 ( 삽질 )
이글은 느낀점, 결론, 자세한 과정, 삽질로 구성됨
느낀점
해결책을 찾는과정에서 헤맸다.
시간이 너무 오래걸렸다. 이것저것 너무 방대해졌다.
공부는 된거 같다. 하지만 결과를 빨리 얻어내는것도 중요하다
이럴경우는 해결책에 집중을해 명료화하고
나머지는 남는 시간에 추가로 하는게 좋을듯 하다
결론
sts4에서 웹프로젝트를 import했더니 오류가남
애러 문구를 바탕으로 stackoverflow에서 해결책을 찾음
gradle-wrapper.properties 이 파일의 distributionUrl 쪽에있는 Gradle version을 변경해서 해결함
아마 sts4의 버전차이에 따른 java,spring버전 차이, 그에 맞는 gradle버전이 이번 오류의 원인이라 생각한다.
자세한 과정
서로다른 2대의 컴퓨터( A, B )가 있고
A,B에는 각각 sts4가 설치되어있음(버전이 다름)
A 에는 sts-4.11.0.RELEASE , B 에는 sts-4.13.1.RELEASE
A에서 만든 웹 프로젝트( spring starter project, Z라고 하겠다 )를 github에 올렸고
B에서 github에있는 Z를 clone받아서 import했더니 오류 발생.
( 이때, Z의 경로를 workspace의 경로와 겹치지 않도록 해야한다 )
ㅡㅡ
오류내용
: Build failed with an exception
Could not compile initialization script 'C:\웹개발\workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle'
General error during conversion: Unsupported class file major version 61
ㅡㅡ
( 이 61이 문제가 있는거 같은데.. ? )
프로젝트\gradle\wrapper\gradle-wrapper.properties 이 파일의
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 이 부분에서
gradle-7.1.1-bin.zip를 gradle-7.4-bin.zip로 변경
해결됨
해결을 위해 stackoverflow을 참조함
https://stackoverflow.com/questions/69425829/unsupported-class-file-major-version-61-error
삽질
A,B의 sts4는 버전이 다르다
eclipsePlugin.gradle은 차이가 없고 일치하지만
java쪽이 다르다는걸 알수 있다.
sts - window - preferences - java - installed JREs 에는
By default, the checked JRE is added to the build path of newly created Java projects. 라는 설명이 있다
java프로젝트를 import하면 sts의 jre버전으로 연동이 되는듯
A
sts-4.11.0.RELEASE
( sts - window - preferences - java - installed JREs 에서의 경로 )
D:\웹개발\springTest\sts-4.11.0.RELEASE\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_16.0.1.v20210528-1205\jre\org.eclipse.justj.properties
위 경로의 파일 org.eclipse.justj.properties 에는
java.class.version=60.0
java.runtime.name=OpenJDK Runtime Environment
java.runtime.version=16.0.1+9-24
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.specification.version=16
java.vendor.url.bug=https\://bugreport.java.com/bugreport/
java.vendor.url=https\://java.oracle.com/
java.vendor=Oracle Corporation
java.version.date=2021-04-20
java.version=16.0.1
java.vm.compressedOopsMode=32-bit
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=16
java.vm.vendor=Oracle Corporation
java.vm.version=16.0.1+9-24
D:\웹개발\springTest\test-workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle
위 경로의 파일 eclipsePlugin.gradle 에는
/*******************************************************************************
* Copyright (c) 2019 Gradle Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/
initscript {
allprojects {
apply plugin: "eclipse"
}
}
B
sts-4.13.1.RELEASE
C:\웹개발\sts-4.13.1.RELEASE\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.1.v20211116-1657\jre\org.eclipse.justj.properties
위 경로의 파일 org.eclipse.justj.properties 에는
java.class.version=61.0
java.runtime.name=OpenJDK Runtime Environment
java.runtime.version=17.0.1+12
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.specification.version=17
java.vendor.url.bug=https\://github.com/adoptium/adoptium-support/issues
java.vendor.url=https\://adoptium.net/
java.vendor.version=Temurin-17.0.1+12
java.vendor=Eclipse Adoptium
java.version.date=2021-10-19
java.version=17.0.1
java.vm.compressedOopsMode=32-bit
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=17
java.vm.vendor=Eclipse Adoptium
java.vm.version=17.0.1+12
C:\웹개발\workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle
위 경로의 파일 eclipsePlugin.gradle 에는
/*******************************************************************************
* Copyright (c) 2019 Gradle Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/
initscript {
allprojects {
apply plugin: "eclipse"
}
}