Ibrahim Ates
Ibrahim Ates

Reputation: 385

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

Upvotes: 14

Views: 52138

Answers (3)

Tekle
Tekle

Reputation: 11

Under the project directory on IntelliJ Idea (the Left panel) go to: gradle -> wrapper -> gradle-wrapper.properties Update the distributionUrl as below. (Version of gradle is 5.6 here) distributionUrl=https://services.gradle.org/distributions/gradle-5.6-bin.zip

Upvotes: 1

Andrey
Andrey

Reputation: 2078

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.

Upvotes: 2

lance-java
lance-java

Reputation: 28061

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

Upvotes: 18

Related Questions