{"record":{"id":"bd3487f503a2fd9d","repo":"quarkusio/quarkus","slug":"cannot-locate-mvnw-or-mvn-make-sure-mvnw-is-in-th","errorCode":null,"errorMessage":"Cannot locate mvnw or mvn. Make sure mvnw is in the project directory or mvn is in your PATH.","messagePattern":"Cannot locate mvnw or mvn\\. Make sure mvnw is in the project directory or mvn is 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":285,"sourceCode":"                } finally {\n                    log.info(\"\");\n                }\n            }\n        } catch (Exception e) {\n            throw new QuarkusUpdateException(\"The %s command exited with an error. %s\".formatted(name, logInfo), e);\n        }\n    }\n\n    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);","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java#L267-L303","documentation":"findMvnBinary(baseDir) uses findWrapperOrBinary(baseDir, \"mvnw\", \"mvn\") to locate the Maven wrapper script in the project or an `mvn` executable on the PATH (adding .cmd/.bat on Windows). If neither is found, it throws QuarkusUpdateException telling the user to put mvnw in the project directory or mvn on the PATH, because the Maven-based OpenRewrite update needs to launch Maven.","triggerScenarios":"QuarkusUpdateCommand.handle() -> runMavenUpdate() on a MAVEN build tool project where: no mvnw/mvnw.cmd exists in baseDir (or its parents) AND no `mvn` binary is resolvable from the PATH environment variable.","commonSituations":"Clean CI containers with no Maven installed and no committed wrapper; freshly cloned projects where the wrapper scripts were excluded by .gitignore; Windows environments where mvn is installed but not on the PATH of the shell running the Quarkus CLI; IDE terminals with a minimal environment.","solutions":["Install Maven and make sure `mvn -v` works in the same shell used to run the Quarkus update command.","Or add the Maven wrapper to the project (run `mvn wrapper:wrapper` once, or copy mvnw/mvnw.cmd plus .mvn/wrapper from a Maven project) so it is committed to the repository.","Verify the PATH contains the Maven bin directory (restart the terminal/CI job after PATH changes).","In CI, use a Maven-provisioned base image or setup step (e.g. setup-maven/actions) before running `quarkus update`."],"exampleFix":"// before\n$ quarkus update\nQuarkusUpdateException: Cannot locate mvnw or mvn. Make sure mvnw is in the project directory or mvn is in your PATH.\n\n// after: add the wrapper and commit it\n$ mvn wrapper:wrapper\n$ ls mvnw .mvn/wrapper/maven-wrapper.properties\n$ quarkus update","handlingStrategy":"validation","validationCode":"import java.io.IOException;\nimport java.nio.file.*;\n\nstatic void requireMavenAvailable(Path baseDir) {\n    boolean wrapper = Files.isRegularFile(baseDir.resolve(\"mvnw\"))\n            || Files.isRegularFile(baseDir.resolve(\"mvnw.cmd\"));\n    boolean onPath = false;\n    try {\n        onPath = new ProcessBuilder(\"mvn\", \"-v\").start().waitFor() == 0;\n    } catch (IOException | InterruptedException ignored) { }\n    if (!wrapper && !onPath) {\n        throw new IllegalStateException(\"mvnw must be in the project directory or mvn on the PATH\");\n    }\n}","typeGuard":"static boolean isMavenAvailable(Path baseDir) {\n    if (Files.isRegularFile(baseDir.resolve(\"mvnw\"))\n            || Files.isRegularFile(baseDir.resolve(\"mvnw.cmd\"))) return true;\n    try {\n        return new ProcessBuilder(\"mvn\", \"-v\").start().waitFor() == 0;\n    } catch (Exception e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    QuarkusUpdateCommand.handle(log, BuildTool.MAVEN, baseDir, rewritePluginVersion, recipesGAV, recipe, logFile, dryRun);\n} catch (QuarkusUpdateException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot locate mvnw or mvn\")) {\n        log.error(\"Install Maven or add the wrapper: `mvn wrapper:wrapper`, then retry `quarkus update`.\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["Commit the Maven wrapper (mvnw, mvnw.cmd, .mvn/wrapper/) to every Maven project so updates work on machines without Maven.","Verify `mvn -v` succeeds in the exact shell/CI job before running `quarkus update`.","After installing Maven, restart the terminal so PATH changes are picked up.","In CI, add a Maven setup step (or use a Maven preinstalled image) prior to the update job."],"tags":["maven","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"}