Fix ./gradlew wrapper run issue in GitHub workflow #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves the
ClassNotFoundException: org.gradle.wrapper.GradleWrapperMainerror that occurred when running./gradlewcommands in GitHub Actions workflows.Root Cause
The issue was caused by a missing
gradle-wrapper.jarfile in thegradle/wrapper/directory. The Gradle wrapper consists of several components:gradlewandgradlew.batscripts ✅ (present)gradle/wrapper/gradle-wrapper.properties✅ (present)gradle/wrapper/gradle-wrapper.jar❌ (missing)Without the JAR file, the wrapper scripts cannot locate the
GradleWrapperMainclass needed to bootstrap Gradle.Changes Made
1. Fixed Gradle Wrapper
gradle-wrapper.jarfor Gradle version 8.14.2.gitignoreto allowgradle-wrapper.jarwhile still excluding other JAR files2. Updated GitHub Workflows
Updated all three workflow files to use the Gradle wrapper instead of manually installing Gradle:
Before:
After:
3. Java Version Consistency
Verification
$ ./gradlew --version Gradle 8.14.2 $ ./gradlew build BUILD SUCCESSFUL in 42sThe wrapper now correctly downloads and uses Gradle 8.14.2 as specified in
gradle-wrapper.properties, eliminating the need for manual Gradle setup in CI pipelines.Fixes #26.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.