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

java.lang.NoClassDefFoundError: org/gradle/internal/classpath/Instrumented #18

Closed
re-thc opened this issue May 16, 2022 · 15 comments
Closed

Comments

@re-thc
Copy link

re-thc commented May 16, 2022

Running this with Gradle 7.5-rc-1 and Java 18.

Getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/gradle/internal/classpath/Instrumented at org.kordamp.gradle.plugin.jandex.tasks.JandexMain$ClassFileVisitor.indexFile(JandexMain.java:172) at org.kordamp.gradle.plugin.jandex.tasks.JandexMain$ClassFileVisitor.visitFile(JandexMain.java:160) at org.kordamp.gradle.plugin.jandex.tasks.JandexMain$ClassFileVisitor.visitFile(JandexMain.java:147) at java.base/java.nio.file.Files.walkFileTree(Files.java:2812) at java.base/java.nio.file.Files.walkFileTree(Files.java:2883) at org.kordamp.gradle.plugin.jandex.tasks.JandexMain.execute(JandexMain.java:98) at org.kordamp.gradle.plugin.jandex.tasks.JandexMain.run(JandexMain.java:124) at org.kordamp.gradle.plugin.jandex.tasks.JandexMain.main(JandexMain.java:111) Caused by: java.lang.ClassNotFoundException: org.gradle.internal.classpath.Instrumented at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 8 more

@aalmiray
Copy link
Collaborator

This is strange. The source does not make reference to internal APIs, it's written in Java so there should not be a dependence on an specific Gradle version as it happens when Groovy code is compiled AFAICT https://github.com/kordamp/jandex-gradle-plugin/blob/master/src/main/java/org/kordamp/gradle/plugin/jandex/tasks/JandexMain.java

@re-thc
Copy link
Author

re-thc commented May 16, 2022

I just tried this on an empty/blank Quarkus project and it builds. Once the jandex-gradle-plugin is added it fails. Either jandex or this plugin but if it's jandex it should fail without this plugin since Quarkus uses it under the hood?

@re-thc
Copy link
Author

re-thc commented May 16, 2022

gradle/gradle#14727 could be this bug? Is there a way we can work around it?

@aalmiray
Copy link
Collaborator

Do you have a reproducible project?

@aalmiray
Copy link
Collaborator

Do you get the failure with an earlier Gradle version? say 7.4?

@re-thc
Copy link
Author

re-thc commented May 16, 2022

7.4.2 is fine. Failure is with 7.5-rc-1. Could be a gradle bug itself or a change of APIs / functionality that has resulted in this. Don't have a specific project yet. Just went to the Quarkus website, checked out a sample and added this plugin to it and triggered the issue.

@aalmiray
Copy link
Collaborator

The plugin reads compiled classes from the output of the main resourceSet, as is. It may be the case those classes have the missing annotation applied to them. The classpath passed to Jandex may not contain the annotation class anymore in 7.5

I don't have access to a computer right now but perhaps running a simple project in debug mode with 7.4.2 vs 7.5 should result in logging the execution classpath used by the JandexMain class. With any luck this should show if a JAR is missing. If not then the annotation used to be located in an existing JAR.

In any case I don't think there's a workaround if Gradle 7.5 is required. If my suspicion is correct then reading classes to be processed must be done in a different way.

@aalmiray
Copy link
Collaborator

Turns out the bug is in setting up the classpath that invokes the JavaExec type that runs JandexMain. I know how to fix this. Expect a release in the coming days.

@re-thc
Copy link
Author

re-thc commented May 29, 2022

Any luck on fixing this? Thanks!

@gbloggs
Copy link

gbloggs commented Jul 21, 2022

I'm just building against the released version of gradle, 7.5 and getting this error.

    id "org.kordamp.gradle.jandex" version "0.12.0"
    id 'io.quarkus' version '2.11.0.Final'


Gradle 7.5

Build time: 2022-07-14 12:48:15 UTC
Revision: c7db7b958189ad2b0c1472b6fe663e6d654a5103

Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.1 (GraalVM Community 17.0.1+12-jvmci-21.3-b05)
OS: Windows 10 10.0 amd64



@gsmet
Copy link

gsmet commented Jul 25, 2022

@aalmiray hey. Any chance this issue could be fixed? It's blocking the Quarkus upgrade to Gradle 7.5.

Thanks!

@aalmiray
Copy link
Collaborator

@gsmet currently looking at it. It appears I'll have to switch to Gradle's Worker API to make it work. Thing is, I'm still learning how to use said API. Hope to get a release ready this week.

@aalmiray
Copy link
Collaborator

@gsmet version 0.13.0 has just been released with the fix. Please let me know if there any further changes are required.

@gsmet
Copy link

gsmet commented Jul 26, 2022

Thanks! @glefloch can you have a look?

@glefloch
Copy link
Contributor

Thanks @aalmiray, I will update quarkus sample projects

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

5 participants