gnodet commented on code in PR #1061: URL: https://github.com/apache/maven/pull/1061#discussion_r1171483867
########## maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java: ########## @@ -320,6 +324,49 @@ void initialize(CliRequest cliRequest) throws ExitException { } } + Path topDirectory = Paths.get(cliRequest.workingDirectory); + boolean isAltFile = false; + for (String arg : cliRequest.args) { + if (isAltFile) { + Path path = Paths.get(arg); + if (Files.isDirectory(path)) { + topDirectory = path; + } else if (Files.isRegularFile(topDirectory)) { + topDirectory = path.getParent(); + if (!Files.isDirectory(topDirectory)) { + System.err.println("Directory " + topDirectory + + " extracted from the -f/--file command-line argument " + arg + " does not exist"); + throw new ExitException(1); + } + } else { + System.err.println( + "POM file " + arg + " specified with the -f/--file command line argument does not exist"); + throw new ExitException(1); + } + break; + } else { + isAltFile = arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file"); Review Comment: Well, the CLI isn't built yet, this is really one of the first things done. Also the point is to be able to leverage those properties during argument interpolation (see https://github.com/apache/maven/pull/1062), so this really has to be done very early. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org