Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Sometime you may face error “Could not find or load main class org.gradle.wrapper.GradleWrapperMain” while working with Gradle project which is very difficult to find out the root cause of the issue. In this article, we’ll explain the root cause of the issue and how to resolve this.
Issue Description
Could not find or load main class org.gradle.wrapper.GradleWrapperMain. Bitbucket pipeline or Jenkins console output, the build is failed – “Could not find org.gradle.wrapper.GradleWrapperMain”
The symptom of the issue
This error will be thrown when we are trying to clean or build the Gradle project and gradlew build unable to find the gradle folder which contains the gradle-wrapper.jar file. This might be possible developer has missed out to check-in the Gradle folder in the repository.
Solution
If wrapper folder doesn’t exist under gradle folder then create the wrapper folder and paste gradle-wrapper.jar & grade-wrapper.properties in the wrapper folder.
Project structure should be as below
—Project Folder
—gradle
–wrapper
–gradle-wrapper.jar
–gradle-wrapper.properties
–gradlew
–graldew.bat
This folder is present but still we are facing the issue
Have you found any solution to this @Gorakh?