Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can fix this error; java.lang.ClassNotFoundException: org.gradle.api.internal.plugins.DefaultConvention

When I wanted to build Gradle, I got the following error.

could you please help me?

Thanks a lot.

java.lang.NoClassDefFoundError: org/gradle/api/internal/plugins/DefaultConvention at org.jetbrains.plugins.gradle.tooling.builder.ProjectExtensionsDataBuilderImpl.buildAll(ProjectExtensionsDataBuilderImpl.groovy:50) ... 122 more

My Gradle latest version is 6.0.1.

Also, I posted to Github. you can find full detail of error and my Gradle code at there; https://github.com/gradle/gradle/issues/11769

like image 576
Ibrahim Ates Avatar asked Dec 28 '19 08:12

Ibrahim Ates


People also ask

How do I fix Java Lang NoClassDefFoundError?

lang. NoClassDefFoundError, which means the Class Loader file responsible for dynamically loading classes can not find the . class file. So to remove this error, you should set your classpath to the location where your Class Loader is present.

How do I find my gradle version?

In the command prompt, enter Gradle -version. It will display the current version of Gradle just installed on the screen.


2 Answers

It looks like one of your plugins (a jetbrains plugin of some sort) is not compatible with Gradle 6. I'm guessing you could fix the issue by either

  • Using an older version of Gradle
  • Upgrading to a newer version of the plugin that supports Gradle 6

It seems that the jetbrains plugin is referencing a Gradle class in an "internal" package. These classes are not part of the public API and can change (or be removed) between Gradle versions without notice, hence the NoClassDefFoundError. Ideally plugins should only reference the public API

like image 192
lance-java Avatar answered Sep 20 '22 05:09

lance-java


For my Idea 2018.2 helped not to use built-in gradle wrapper, but to install gradle 5.6.4 (which has that org/gradle/api/internal/plugins/DefaultConvention) and specify home directory of that gradle when importing project to Idea.

like image 39
Andrey Avatar answered Sep 24 '22 05:09

Andrey