Gradle wrapper main class ☕ Java

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

The Gradle wrapper JAR (gradle/wrapper/gradle-wrapper.jar) is missing or corrupt.

Seen on: Java

Meaning

gradlew needs gradle-wrapper.jar. It’s often excluded by .gitignore (*.jar) or not committed, so fresh clones and CI fail.

Common causes

  • gradle-wrapper.jar not committed (ignored by *.jar)
  • Corrupted download
  • Running gradlew from the wrong directory

⚡ Quick fix

  1. Regenerate: gradle wrapper (with a local Gradle)
  2. Commit gradle/wrapper/gradle-wrapper.jar and add a .gitignore exception

Detailed fix by platform

Java

  1. .gitignore: !gradle/wrapper/gradle-wrapper.jar

How to diagnose

  1. File — Does gradle/wrapper/gradle-wrapper.jar exist?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.