Gradle error: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

Joshua Spinak :

I need to see my dependencies in Gradle to fix a problem with multiple SLF4J bindings.
However, when I run 'gradle dependencies' I get the error:

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

In a similar question in stack-overflow Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
it was recommended to

  1. install java jdk-14
  2. upgrade to gradle version 6.3

I changed the jdk to 14 in IntelliJ in 2 places:

  1. File -> Project Structure -> Project -> Project SDK
  2. Preferences -> Gradle -> Gradle JVM

I attempted to update gradle from the command line with: 'gradle wrapper --gradle-version 6.3' and got the same error:

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

I then changed the field 'distributionUrl' in the file 'gradle-wrapper.properties' to 'gradle-6.3', as instructed here https://github.com/gradle/gradle/issues/10248.

I tried various combinations of jdk and gradle versions but nothing seems to work.

tim_yates :

So from your repo, if you have gradle-wrapper.properties like this:

➜ cat gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

On first compilation, Gradle tells you that:

  build file '/Users/tim/Code/Java/brobotREST/build.gradle': 36:
     all buildscript {} blocks must appear before any plugins {} blocks in the script

So if you move the buildscript section up to the top of the build.gradle file, it all seems to work

And I get:

➜ ./gradlew -version

------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          14 (Azul Systems, Inc. 14+36)
OS:           Mac OS X 10.15.4 x86_64

Este artículo se recopila de Internet, indique la fuente cuando se vuelva a imprimir.

En caso de infracción, por favor [email protected] Eliminar

Editado en
0

Déjame decir algunas palabras

0Comentarios
Iniciar sesiónRevisión de participación posterior

Artículos relacionados

Error de Gradle: no se pudo inicializar la clase org.codehaus.groovy.runtime.InvokerHelper

Android Studio no pudo inicializar la clase org.codehaus.groovy.runtime.InvokerHelper

Cuando se utiliza Oracle JDK 14, todas las tareas de gradle (6.2.2) fallan con "No se pudo inicializar la clase org.codehaus.groovy.runtime.InvokerHelper"

Gradle : Could not find org.codehaus.groovy:groovy:1.0.0

DataGrip org.codehaus.groovy.control.MultipleCompilationErrorsException: error de inicio:

org.codehaus.groovy.grails.cli.support.GrailsStarter error no encontrado

Obteniendo el error de resolución al importar el proyecto en Android Studio, no se puede cargar la clase 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'

Не удалось инициализировать класс org.codehaus.groovy.reflection.ReflectionCache

Resolver error java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ModuleNode.getStarImports () Ljava / util / List;

¿Por qué obtengo el error de compilación "org / codehaus / groovy / control / CompilationFailedException"?

error import org.codehaus.groovy.grails.commons.ApplicationHolder como AH

Los scripts no pueden usar staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods escriben java.io.File java.lang.String

Los scripts no pueden usar staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods escriben java.io.File java.lang.String

Weblogic Error - Could not initialize class weblogic.jndi.Environment

ошибка импорта org.codehaus.groovy.grails.commons.ApplicationHolder как AH

패브릭 플러그인 충돌-> 해당 속성 없음 : 클래스에 대한 betaDistributionApkFilePath : org.codehaus.groovy.runtime.GStringImpl

Detox - Could not initialize class DefaultKotlinSourceSetKt

React-native: impossible d'initialiser la classe org.codehaus.groovy.reflection.ReflectionCache

Obteniendo NoClassDefFoundError: No se pudo inicializar la clase org.codehaus.groovy.vmplugin.v7.Java7

Spring Tool Suite (STS) 3.5.0 - org.codehaus.groovy.eclipse es desconocido en el solucionador

Plugin execution not covered by lifecycle configuration: org.codehaus.gmaven:groovy-maven-plugin:2.1.1

Конфликт задач и плагинов в Gradle (не удалось применить плагин [class 'org.gradle.langu ...)

No se pudo descargar groovy-all.jar (org.codehaus.groovy: groovy-all: 2.4.15) en Android Studio 3.3 Beta 2

Installing Kotlin-Jupyter: e: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel

Gradle - Could not find load main class

Error al ejecutar el objetivo org.codehaus.mojo: exec-maven-plugin: 1.5.0: exec

Error al ejecutar el objetivo org.codehaus.mojo: exec-maven-plugin: 1.6.0: java

Error al ejecutar el objetivo org.codehaus.mojo: exec-maven-plugin: 1.6.0: java

parseSdkContent failed Could not initialize class android.graphics.Typeface

TOP Lista

CalienteEtiquetas

Archivo