in daemon-m40/src/main/java/org/apache/maven/cli/DaemonMavenCli.java [304:351]
void cli(CliRequest cliRequest) throws Exception {
CLIManager cliManager = newCLIManager();
CommandLine mavenConfig = null;
try {
File configFile = new File(cliRequest.multiModuleProjectDirectory, MVN_MAVEN_CONFIG);
if (configFile.isFile()) {
try (Stream<String> lines = Files.lines(configFile.toPath(), Charset.defaultCharset())) {
String[] args = lines.filter(arg -> !arg.isEmpty() && !arg.startsWith("#"))
.toArray(String[]::new);
mavenConfig = cliManager.parse(args);
List<?> unrecognized = mavenConfig.getArgList();
if (!unrecognized.isEmpty()) {
// This file can only contain options, not args (goals or phases)
throw new ParseException("Unrecognized maven.config file entries: " + unrecognized);
}
}
}
} catch (ParseException e) {
buildEventListener.log("Unable to parse maven.config: " + e.getMessage());
buildEventListener.log("Run 'mvnd --help' for available options.");
throw new ExitException(1);
}
try {
if (mavenConfig == null) {
cliRequest.commandLine = cliManager.parse(cliRequest.args);
} else {
cliRequest.commandLine = cliMerge(cliManager.parse(cliRequest.args), mavenConfig);
}
} catch (ParseException e) {
buildEventListener.log("Unable to parse command line options: " + e.getMessage());
buildEventListener.log("Run 'mvnd --help' for available options.");
throw new ExitException(1);
}
// check for presence of unsupported command line options
try {
if (cliRequest.commandLine.hasOption("llr")) {
throw new UnrecognizedOptionException("Option '-llr' is not supported starting with Maven 3.9.1");
}
} catch (ParseException e) {
System.err.println("Unsupported options: " + e.getMessage());
cliManager.displayHelp(System.out);
throw e;
}
}