quarkusio/quarkus · error · QuarkusUpdateException
Cannot gradlew mvnw or gradle. Make sure gradlew is in the c
Error message
Cannot gradlew mvnw or gradle. Make sure gradlew is in the current directory or gradle in your PATH.
What it means
findGradleBinary(baseDir) uses findWrapperOrBinary(baseDir, "gradlew", "gradle") to locate the Gradle wrapper or a `gradle` binary on the PATH (with .bat/.cmd handling on Windows). If neither is found it throws QuarkusUpdateException. Note the message itself contains a typo ("Cannot gradlew mvnw or gradle"), but the meaning is: gradlew must be in the current directory or gradle on the PATH.
Source
Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java:294
private static List<String> prepareCommand(List<String> command) {
final List<String> effectiveCommand = new ArrayList<>(command);
propagateSystemPropertyIfSet("maven.repo.local", effectiveCommand);
return effectiveCommand;
}
static String findMvnBinary(Path baseDir) {
Path mavenCmd = findWrapperOrBinary(baseDir, "mvnw", "mvn");
if (mavenCmd == null) {
throw new QuarkusUpdateException("Cannot locate mvnw or mvn"
+ ". Make sure mvnw is in the project directory or mvn is in your PATH.");
}
return mavenCmd.toString();
}
static String findGradleBinary(Path baseDir) {
Path gradleCmd = findWrapperOrBinary(baseDir, "gradlew", "gradle");
if (gradleCmd == null) {
throw new QuarkusUpdateException("Cannot gradlew mvnw or gradle"
+ ". Make sure gradlew is in the current directory or gradle in your PATH.");
}
return gradleCmd.toString();
}
private static Path findWrapperOrBinary(Path baseDir, String wrapper, String cmd) {
Path found = searchPath(wrapper, baseDir.toString());
if (found == null) {
found = searchPath(cmd);
}
return found;
}
/**
* Searches the locations defined by PATH for the given executable
*
* @param cmd The name of the executable to look for
* @return A Path to the executable, if found, null otherwiseView on GitHub (pinned to e1c734241f)
Solutions
- Ensure the Gradle wrapper is present at the project root (run `gradle wrapper` once with a system Gradle, or copy gradlew, gradlew.bat and gradle/wrapper/* from another project) and commit it.
- Or install Gradle and confirm `gradle -v` resolves in the same shell running the Quarkus CLI.
- Fix PATH so the Gradle bin directory (or SDKMAN current link) is included; restart the terminal afterward.
- On Unix, also check gradlew has the executable bit set (chmod +x gradlew) so it is recognized as a usable wrapper.
Example fix
// before $ quarkus update QuarkusUpdateException: Cannot gradlew mvnw or gradle. Make sure gradlew is in the current directory or gradle in your PATH. // after: generate the wrapper and retry $ gradle wrapper $ chmod +x gradlew $ quarkus update
Defensive patterns
Strategy: validation
Validate before calling
import java.io.IOException;
import java.nio.file.*;
static void requireGradleAvailable(Path baseDir) {
boolean wrapper = Files.isRegularFile(baseDir.resolve("gradlew"))
|| Files.isRegularFile(baseDir.resolve("gradlew.bat"));
boolean onPath = false;
try {
onPath = new ProcessBuilder("gradle", "-v").start().waitFor() == 0;
} catch (IOException | InterruptedException ignored) { }
if (!wrapper && !onPath) {
throw new IllegalStateException("gradlew must be in the project directory or gradle on the PATH");
}
} Type guard
static boolean isGradleAvailable(Path baseDir) {
if (Files.isRegularFile(baseDir.resolve("gradlew"))
|| Files.isRegularFile(baseDir.resolve("gradlew.bat"))) return true;
try {
return new ProcessBuilder("gradle", "-v").start().waitFor() == 0;
} catch (Exception e) {
return false;
}
} Try / catch
try {
QuarkusUpdateCommand.handle(log, BuildTool.GRADLE, baseDir, rewritePluginVersion, recipesGAV, recipe, logFile, dryRun);
} catch (QuarkusUpdateException e) {
if (e.getMessage() != null && e.getMessage().contains("gradle in your PATH")) {
log.error("Run `gradle wrapper` to add the wrapper, or install Gradle and add it to PATH, then retry.");
} else {
throw e;
}
} Prevention
- Commit the Gradle wrapper (gradlew, gradlew.bat, gradle/wrapper/) to every Gradle project; never gitignore it.
- Ensure gradlew keeps the executable bit (chmod +x gradlew) in the repository.
- Verify `gradle -v` resolves in the same shell/CI environment before running `quarkus update`.
- On Windows, confirm gradle.bat is on PATH for the terminal used to launch the Quarkus CLI.
When it happens
Trigger: QuarkusUpdateCommand.handle() -> runGradleUpdate() on a GRADLE or GRADLE_KOTLIN_DSL project where: no gradlew/gradlew.bat exists in baseDir (or its parents) AND no `gradle` binary is resolvable from the PATH environment variable.
Common situations: Projects that rely on a system Gradle not installed on the current machine; CI images without Gradle; projects where gradlew was not committed or lost execute permission; Windows terminals where gradle.bat is not on PATH; users who installed Gradle via SDKMAN but in a different shell environment.
Related errors
- Cannot locate mvnw or mvn. Make sure mvnw is in the project
- Unable to find command: %s in $PATH: %s
- Unable to find ${name} command
- Error while running Gradle rewrite command, see the executio
- The %s command exited with an error. %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/49908aa47ea3e080.
Report an issue: GitHub.