Enter your keyword

post

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    

Post this, try to build the project again and you will notice that the error is no more.

Some Toughts (2)

  1. added on 21 Jan, 2019
    Reply

    This folder is present but still we are facing the issue

  2. added on 18 Apr, 2019
    Reply

    Have you found any solution to this @Gorakh?

Leave a Reply

Your email address will not be published.