{"record":{"id":"a2c6dfb98c1eb454","repo":"quarkusio/quarkus","slug":"error-configuring-command-line-reason-message","errorCode":null,"errorMessage":"Error configuring command-line. Reason: {message}","messagePattern":"Error configuring command-line\\. Reason: (.+?)","errorType":"exception","errorClass":"MavenInvocationException","httpStatus":null,"severity":"error","filePath":"test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvoker.java","lineNumber":63,"sourceCode":"        if (mavenExecutable != null) {\n            cliBuilder.setMavenExecutable(mavenExecutable);\n        }\n\n        File workingDirectory = getWorkingDirectory();\n        if (workingDirectory != null) {\n            cliBuilder.setBaseDirectory(getWorkingDirectory());\n        }\n\n        request.setBatchMode(true);\n\n        Commandline cli;\n        try {\n            cli = cliBuilder.build(request);\n            if (logger != null) {\n                logger.debug(\"Running Maven CLI command: \" + cli);\n            }\n        } catch (CommandLineConfigurationException e) {\n            throw new MavenInvocationException(\"Error configuring command-line. Reason: \" + e.getMessage(), e);\n        }\n\n        MavenProcessInvocationResult result = new MavenProcessInvocationResult();\n\n        try {\n            Process process = executeCommandLine(cli, request);\n            result.setProcess(process);\n        } catch (CommandLineException e) {\n            result.setException(e);\n        }\n\n        return result;\n    }\n\n    private Process executeCommandLine(Commandline cli, InvocationRequest request)\n            throws CommandLineException {\n        InvocationOutputHandler outputHandler = request.getOutputHandler(this.outputHandler);\n        InvocationOutputHandler errorHandler = request.getErrorHandler(this.errorHandler);","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvoker.java#L45-L81","documentation":"MavenProcessInvoker.execute() wraps maven-invoker's CommandLineConfigurationException in a MavenInvocationException with the message \"Error configuring command-line. Reason: {message}\". It is thrown when the invoker cannot build a valid Commandline from the InvocationRequest — before any Maven process is spawned. The embedded cause message describes the actual configuration problem.","triggerScenarios":"Calling MavenProcessInvoker.execute() with an InvocationRequest that the maven-invoker CLI builder rejects — e.g. invalid working directory, missing/invalid maven home, bad JVM or Maven arguments that cannot be assembled into a command line.","commonSituations":"Tests setting a wrong invoker.setMavenHome()/workingDirectory path, unsupported or malformed -D/jvmArgs options, environment where MAVEN_HOME is unset or points to a non-Maven directory, maven-invoker version incompatibility with requested options.","solutions":["Read the cause's message (e.getCause() from the MavenInvocationException) to see which request property is invalid.","Verify the working directory and Maven home in the InvocationRequest/Invoker exist and are valid directories.","Simplify/sanitize mavenOpts, goals, and properties passed in the request to remove malformed arguments.","Check the maven-invoker dependency version matches the options you are using."],"exampleFix":"// before\ninvoker.setMavenHome(\"/path/that/does/not/exist\");\ninvoker.execute(request);\n// after\nFile mavenHome = new File(System.getenv(\"MAVEN_HOME\"));\nif (!mavenHome.isDirectory()) {\n    throw new IllegalStateException(\"MAVEN_HOME invalid: \" + mavenHome);\n}\ninvoker.setMavenHome(mavenHome.getAbsolutePath());\ninvoker.execute(request);","handlingStrategy":"try-catch","validationCode":"File wd = request.getBaseDirectory() != null ? new File(request.getBaseDirectory()) : null;\nif (wd != null && !wd.isDirectory()) {\n    throw new IllegalStateException(\"Invalid working directory: \" + wd);\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = invoker.execute(request);\n} catch (MavenInvocationException e) {\n    Throwable cause = e.getCause(); // CommandLineConfigurationException\n    throw new AssertionError(\"Maven CLI configuration failed: \"\n        + (cause != null ? cause.getMessage() : e.getMessage()), e);\n}","preventionTips":["Validate working directory and Maven home paths before building the InvocationRequest.","Log the resolved CLI command (logger.debug(\"Running Maven CLI command: \" + cli)) when debugging configuration issues.","Keep maven-invoker dependency versions aligned with the options used in the request.","Fail fast in test setup if MAVEN_HOME/mvn binary is missing."],"tags":["java","maven","command-line","configuration"],"backgroundTag":"command-line-configuration-error","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"}