{"record":{"id":"95f4322ccd83462b","repo":"quarkusio/quarkus","slug":"error-while-running-gradle-rewrite-command-see-th","errorCode":null,"errorMessage":"Error while running Gradle rewrite command, see the execution logs above for more details","messagePattern":"Error while running Gradle rewrite command, see the execution logs above for more details","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":124,"sourceCode":"                                \"rewriteFile\", rewriteFile,\n                                \"pluginVersion\", rewritePluginVersion,\n                                \"recipesGAV\", recipesGAV,\n                                \"activeRecipe\", RECIPE_IO_QUARKUS_OPENREWRITE_QUARKUS,\n                                \"plainTextMask\", ADDITIONAL_SOURCE_FILES_SET.stream()\n                                        .map(s -> \"\\\"\" + s + \"\\\"\")\n                                        .collect(Collectors.joining(\", \")))));\n            }\n            final String gradleBinary = findGradleBinary(baseDir);\n            List<String> command = List.of(gradleBinary.toString(), \"--console\", \"plain\", \"--stacktrace\",\n                    \"--init-script\",\n                    tempInit.toAbsolutePath().toString(), dryRun ? \"rewriteDryRun\" : \"rewriteRun\");\n            Map<String, List<String>> commands = new LinkedHashMap<>();\n            commands.put(getRewriteCommandName(rewritePluginVersion, dryRun), command);\n            executeRewrite(baseDir, commands, log, logFile);\n        } catch (QuarkusUpdateException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new QuarkusUpdateException(\n                    \"Error while running Gradle rewrite command, see the execution logs above for more details\", e);\n        } finally {\n            if (tempInit != null) {\n                try {\n                    Files.deleteIfExists(tempInit);\n                } catch (Exception e) {\n                    // ignore\n                }\n            }\n\n        }\n    }\n\n    private static String getMavenSettingsArg() {\n        final String mavenSettings = System.getProperty(\"maven.settings\");\n        if (mavenSettings != null) {\n            return Files.exists(Paths.get(mavenSettings)) ? mavenSettings : null;\n        }","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java#L106-L142","documentation":"runGradleUpdate() writes a temporary OpenRewrite init script (openrewrite-init.gradle), resolves the Gradle binary, and invokes gradle rewriteRun/rewriteDryRun via executeRewrite(). If anything fails in that flow other than a QuarkusUpdateException already thrown (e.g. the Gradle build fails, the init script cannot be written/read), it is wrapped in QuarkusUpdateException with a generic message telling the user to inspect the execution logs printed above.","triggerScenarios":"QuarkusUpdateCommand.handle() -> runGradleUpdate() on a Gradle project where: (a) the Gradle rewriteRun/rewriteDryRun execution exits with an error (compilation failures, recipe/plugin download failures, incompatible Gradle version), (b) the classpath resource /openrewrite-init.gradle is missing (inputStream null), or (c) reading/writing the temp init script throws IOException.","commonSituations":"Running `quarkus update` on a Gradle project whose code does not compile before migration, corporate proxies or repositories blocking download of the OpenRewrite Gradle plugin, or a Gradle version too old for the rewrite plugin's API (e.g. rewriteDryRun task missing).","solutions":["Read the Gradle execution output printed just above the error (and the --stacktrace output); the root cause is there, not in this message.","Make sure the project compiles first: run `./gradlew compileJava compileTestJava` and fix errors before re-running the update.","Verify network/repo access to Maven Central so the OpenRewrite Gradle plugin and recipes GAV can be resolved.","Re-run with a dry run first (`quarkus update --dry-run`) to isolate recipe failures from applied changes.","If the nested cause shows a missing init-script resource, verify the quarkus update CLI and extension versions are consistent (do not mix a newer CLI with older devtools)."],"exampleFix":"// before: update fails because the project does not compile\n$ quarkus update\nError while running Gradle rewrite command, see the execution logs above for more details\n  Caused by: ... compilation error\n\n// after: fix compilation first, then update\n$ ./gradlew compileJava   # fix reported errors\n$ quarkus update","handlingStrategy":"try-catch","validationCode":"import java.nio.file.*;\n\nstatic void validateGradleProject(Path baseDir) throws IllegalStateException {\n    if (!(Files.exists(baseDir.resolve(\"build.gradle\"))\n            || Files.exists(baseDir.resolve(\"build.gradle.kts\")))) {\n        throw new IllegalStateException(\"No Gradle build file in \" + baseDir);\n    }\n    if (!Files.isExecutable(baseDir.resolve(\"gradlew\"))\n            && nativeCommand(\"gradle\") == null) {\n        throw new IllegalStateException(\"gradlew missing in project and gradle not on PATH\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    QuarkusUpdateCommand.handle(log, BuildTool.GRADLE, baseDir, rewritePluginVersion, recipesGAV, recipe, logFile, dryRun);\n} catch (QuarkusUpdateException e) {\n    // real cause is in the nested exception / printed Gradle logs\n    e.getCause().printStackTrace();\n    log.error(\"Gradle rewrite failed: %s. Check the Gradle output above and the log file %s.\",\n        e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), logFile);\n}","preventionTips":["Run `./gradlew compileJava compileTestJava` (or --dry-run first) before `quarkus update` so compilation errors surface early.","Ensure network/proxy settings (gradle.properties, init scripts) allow downloading the OpenRewrite Gradle plugin and recipe artifacts.","Keep the Quarkus CLI and project Quarkus version aligned; use a Gradle version compatible with the rewrite plugin.","Always pass --log-file (or capture output) when scripting the update so the root cause is preserved."],"tags":["gradle","openrewrite","process-execution","update-command"],"backgroundTag":"gradle-build-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}