{"record":{"id":"49908aa47ea3e080","repo":"quarkusio/quarkus","slug":"cannot-gradlew-mvnw-or-gradle-make-sure-gradlew-i","errorCode":null,"errorMessage":"Cannot gradlew mvnw or gradle. Make sure gradlew is in the current directory or gradle in your PATH.","messagePattern":"Cannot gradlew mvnw or gradle\\. Make sure gradlew is in the current directory or gradle in your PATH\\.","errorType":"exception","errorClass":"QuarkusUpdateException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java","lineNumber":294,"sourceCode":"    private static List<String> prepareCommand(List<String> command) {\n        final List<String> effectiveCommand = new ArrayList<>(command);\n        propagateSystemPropertyIfSet(\"maven.repo.local\", effectiveCommand);\n        return effectiveCommand;\n    }\n\n    static String findMvnBinary(Path baseDir) {\n        Path mavenCmd = findWrapperOrBinary(baseDir, \"mvnw\", \"mvn\");\n        if (mavenCmd == null) {\n            throw new QuarkusUpdateException(\"Cannot locate mvnw or mvn\"\n                    + \". Make sure mvnw is in the project directory or mvn is in your PATH.\");\n        }\n        return mavenCmd.toString();\n    }\n\n    static String findGradleBinary(Path baseDir) {\n        Path gradleCmd = findWrapperOrBinary(baseDir, \"gradlew\", \"gradle\");\n        if (gradleCmd == null) {\n            throw new QuarkusUpdateException(\"Cannot gradlew mvnw or gradle\"\n                    + \". Make sure gradlew is in the current directory or gradle in your PATH.\");\n        }\n        return gradleCmd.toString();\n    }\n\n    private static Path findWrapperOrBinary(Path baseDir, String wrapper, String cmd) {\n        Path found = searchPath(wrapper, baseDir.toString());\n        if (found == null) {\n            found = searchPath(cmd);\n        }\n        return found;\n    }\n\n    /**\n     * Searches the locations defined by PATH for the given executable\n     *\n     * @param cmd The name of the executable to look for\n     * @return A Path to the executable, if found, null otherwise","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java#L276-L312","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ quarkus update\nQuarkusUpdateException: Cannot gradlew mvnw or gradle. Make sure gradlew is in the current directory or gradle in your PATH.\n\n// after: generate the wrapper and retry\n$ gradle wrapper\n$ chmod +x gradlew\n$ quarkus update","handlingStrategy":"validation","validationCode":"import java.io.IOException;\nimport java.nio.file.*;\n\nstatic void requireGradleAvailable(Path baseDir) {\n    boolean wrapper = Files.isRegularFile(baseDir.resolve(\"gradlew\"))\n            || Files.isRegularFile(baseDir.resolve(\"gradlew.bat\"));\n    boolean onPath = false;\n    try {\n        onPath = new ProcessBuilder(\"gradle\", \"-v\").start().waitFor() == 0;\n    } catch (IOException | InterruptedException ignored) { }\n    if (!wrapper && !onPath) {\n        throw new IllegalStateException(\"gradlew must be in the project directory or gradle on the PATH\");\n    }\n}","typeGuard":"static boolean isGradleAvailable(Path baseDir) {\n    if (Files.isRegularFile(baseDir.resolve(\"gradlew\"))\n            || Files.isRegularFile(baseDir.resolve(\"gradlew.bat\"))) return true;\n    try {\n        return new ProcessBuilder(\"gradle\", \"-v\").start().waitFor() == 0;\n    } catch (Exception e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    QuarkusUpdateCommand.handle(log, BuildTool.GRADLE, baseDir, rewritePluginVersion, recipesGAV, recipe, logFile, dryRun);\n} catch (QuarkusUpdateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"gradle in your PATH\")) {\n        log.error(\"Run `gradle wrapper` to add the wrapper, or install Gradle and add it to PATH, then retry.\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["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."],"tags":["gradle","missing-binary","path","environment","update-command"],"backgroundTag":"command-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}