michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171512493
##########
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:
Aha, then a comment should accompany that code,
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]