Importing and using gradle on IntelliJ macOs

I am using grade for first time in macOS I downloaded Homebrew and installed cradle through terminal then I created a new Version Control Project File importer the URL of GitHub projects location and typed ./gradlew run on IntelliJ’s terminal, this is what it returned me:
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

What is going on please help!

Hard to say from the information you provided.
Installing Gradle is actually pointless.
You practically never need any Gradle version installed.
All projects should contain the 4 Gradle wrapper files and those should be used to execute a build.
These then automatically provision and use the Gradle version the build is designed for and known to work with.
The only thing you need to have installed is a Java version compatible to the Gradle version you want to run.

The error you see usually comes if the project you try to build does only have some of the 4 wrapper files present.
Namely if the gradlew script is there, but the gradle/wrapper/gradle-wrapper.jar file is missing, then exactly that error is shown and is a build bug in that project.

Some projects have a strict no-binaries-in-repository policy and might miss the jar due to that.
But usually such projects should provide information how you are supposed to build them in some file like a readme or contributing file.

Thank you very much for that information. Can you tell me where can I find the gradle/wrapper/gradle-wrapper.jar file?

As I said, it should be part of the project you cloned.

1 Like