본문 바로가기

웹 프레임워크/Spring

gradlew org.codehaus.groovy.runtime.InvokerHelper 문제 해결

문제

./gradlew clean build

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* 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

Spring 빌드를 하려고 했으나,  실패한다.

org.codehaus.groovy.runtime.InvokerHelper 클래스를 초기화 할수 없다고 한다.

 

좀 찾아보니, gradle버전에 따라 java 버전을 호환하는게 다르다고 한다.

 

 

./gradlew -version

------------------------------------------------------------
Gradle 5.6.4
------------------------------------------------------------

Build time:   2019-11-01 20:42:00 UTC
Revision:     dd870424f9bd8e195d614dc14bb140f43c22da98

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          14.0.2 (Oracle Corporation 14.0.2+12-46)
OS:           Mac OS X 10.15.6 x86_64

현재 나의 gradlew 버전은 5.6.4이다.

 

java --version
openjdk 14.0.2 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

그리고 java 버전은 14.0.2 이다.

 

https://docs.gradle.org/6.3/release-notes.html

 

Gradle 6.3 Release Notes

The Gradle team is excited to announce Gradle 6.3. We would like to thank the following community contributors to this release of Gradle: Improvements for plugin authors Every module that is pulled from a repository has metadata associated with it, such as

docs.gradle.org

6.3 문서를 보니 java 14를 서폿한다고 한다. 

5.6.4 버전에서 14를 쓰려니 안되었던.... ㅠ

 

 

https://docs.gradle.org/5.6.4/userguide/installation.html

5.6.4 설치 문서에 갔더니 8보다 높은거 쓰라고 한다.

 

 

java -version

java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

https://www.oracle.com/kr/java/technologies/javase/javase-jdk8-downloads.html

8을 다운 받아서 설치한 뒤에 실행을 해봤다.

 

Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.

* 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 5s
2 actionable tasks: 2 executed

에러메시지가 달라졌다. 11을 설치하라고 한다. ㅠ

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

 

 

해결

java -version

java version "11.0.8" 2020-07-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.8+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode)

https://www.oracle.com/java/technologies/javase-jdk11-downloads.html

11을 설치했다.

 

잘된다 굿