Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[help] how to fix error: class org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService$Inject cannot be cast to class org.graalvm.buildtools.gradle.in ternal.GraalVMReachabilityMetadataService #706

Closed
lost22git opened this issue Apr 28, 2023 · 4 comments

Comments

@lost22git
Copy link

Issue description

version => 4.0.0-M1

native build error:

> class org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService$Inject cannot be cast to class org.graalvm.buildtools.gradle.in
ternal.GraalVMReachabilityMetadataService (org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService$Inject is in unnamed module 
of loader org.gradle.internal.classloader.VisitableURLClassLoader @7c519acc; org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @7ef5359d)

@melix
Copy link
Collaborator

melix commented May 4, 2023

Please provide more information about how to reproduce this problem. Which version of Gradle you are using, etc. 4.0.0-M1 is a pre-release of the Gradle Plugin aimed for Micronaut 4.

@melix
Copy link
Collaborator

melix commented May 11, 2023

I could reproduce and this turns out to be the same issue as gradle/gradle#17559

The workaround is to put the plugins on your build script classpath.

@msgilligan
Copy link

msgilligan commented Nov 25, 2023

I ran into this issue in a Gradle multi-project build where there are two Micronaut apps and three command-line tools that are not using Micronaut that needed to include the 'org.graalvm.buildtools.native' plugin directly. The workaround for me (seems to be) using the following in the command-line tool subprojects:

id("io.micronaut.application") version "${micronautAppGradlePluginVersion}"

instead of:

id 'org.graalvm.buildtools.native' version '0.9.28'

I'd rather not have those subprojects pick up a Micronaut dependency, but the workaround seems to work.

msgilligan added a commit to ConsensusJ/consensusj that referenced this issue Nov 25, 2023
* cj-btc-cli
* consensusj-jsonrpc (MathTool simple test)
* consensusj-jsonrpc-cli

Previously these were built by calling `native-image` with `Exec`.

Because of these two issues:

* micronaut-projects/micronaut-gradle-plugin#706
* gradle/gradle#17559

we're referencing the Micronaut application plugin in the three
subprojects rather than the GraalVM Gradle plugin directly.
@steventen
Copy link

We ended up using id("io.micronaut.minimal.application") to "solve" this issue, since we don't rely on GraalVM in our project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants