Could not find GradleWrapperMain

Avatar of Rakesh Mothukuri

Rakesh Mothukuri

| Reading Time : 1 minute

Avatar of Rakesh Mothukuri Avatar of Rakesh Mothukuri Avatar of Rakesh Mothukuri Avatar of Rakesh Mothukuri

Problem

Jenkins console output, the build is failed with error - “Could not find org.gradle.wrapper.GradleWrapperMain”

[Gradle] - Launching build.
[workspace] $ /var/lib/jenkins/jobs/GradleTest/workspace/gradlew clean test

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

Solution

  1. The class GradleWrapperMain is inside the gradle-wrapper.jaris not available for build. Most common scenario is that file gradle-wrapper.jar missed from check-in.(due to .jar in .gitignore ?)
  2. To fix it, create a Gradle wrapper again, and make sure the following files and folders are added to your version control system like GitHub.
|---gradle
    |---wrapper
        |---gradle-wrapper.jar
        |---gradle-wrapper.properties
|---gradlew
|---gradlew.bat

Done.