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

In addition to @RaGe’s answer may be the situation I faced where i had a global git ignore that was ignoring .jar files and so the gradle wrapper jar was never being committed. Thus I was getting that error on the Jenkins server after an attempted /var/lib/jenkins/my_project/gradlew build. I had to explicitly force an add of the jar and then commit:

git add -f gradle/wrapper/gradle-wrapper.jar

Leave a Comment