Skip to content

ClassCastException: org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String in Gradle build #801

Open
@jjancicc

Description

@jjancicc

When running scip-java index, an error occurs related to GStringImpl and java.lang.String. The error message is as follows:

class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class java.lang.String (org.codehaus.groovy.runtime.GStringImpl is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader; java.lang.String is in module java.base of loader 'bootstrap')
The error occurs when attempting to apply the plugin io.micronaut.build.internal.docs during the project configuration phase. The full stack trace is as follows:

An exception occurred applying plugin request [id: 'io.micronaut.build.internal.docs']
> Failed to apply plugin class 'io.micronaut.build.docs.JavadocAggregatorPlugin'.
   > A problem occurred configuring project ':benchmarks'.
      > class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class java.lang.String

Steps to Reproduce:
Run the Gradle build with the following command:

gradlew --no-daemon --init-script /path/to/init-script.gradle -Pkotlin.compiler.execution.strategy=in-process -Dsemanticdb.targetroot=/path/to/semanticdb-targetroot clean scipPrintDependencies scipCompileAll
The build fails with the error shown above.

Expected Behavior:
The build should complete successfully without the error.

Environment:
Gradle version: 8.14.3
Groovy version: 3.0.24
Kotlin version: 2.0.21
JDK version: JDK-17

Additional Notes:
The error might be caused by an incompatibility between the Groovy and JDK versions, or by unresolved dependencies in the Gradle script.

It appears to be an issue with the conversion of GString to a standard Java String.

What I discovered is that issue is caused by --init-script coming from scip-java index command, as executing same command w/out init-script works well. Would be nice to have a feature same as for -- <build_commands> to enable to skip running init-script for Gradle builds. Maybe adding a flag --skip-init-script would be a good option if possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions