Github user rpatrick00 commented on a diff in the pull request:
https://github.com/apache/maven/pull/94#discussion_r86667111
--- Diff: apache-maven/src/bin/mvn.cmd ---
@@ -86,19 +86,65 @@ set MAVEN_CMD_LINE_ARGS=%*
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
if not "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-set "EXEC_DIR=%CD%"
-set "WDIR=%EXEC_DIR%"
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+
+@REM Look for the --file switch and start the search for the .mvn
directory from the specified
+@REM POM location, if supplied.
+
+set FILE_ARG=
+:arg_loop
+if "%1" == "-f" (
+ set "FILE_ARG=%2"
+ shift
+ goto process_file_arg
+)
+if "%1" == "--file" (
+ set "FILE_ARG=%2"
+ shift
+ goto process_file_arg
+)
+@REM If none of the above, skip the argument
+shift
+if not "%~1" == "" (
+ goto arg_loop
+) else (
+ goto findBaseDir
+)
+
+:process_file_arg
+if "%FILE_ARG%" == "" (
+ goto findBaseDir
+)
+call :get_directory_from_file %FILE_ARG%
+if not exist "%POM_DIR%" (
--- End diff --
Like it or not, sh and cmd are different and have different capabilities.
In the sh script, we know that the directory exists because of the check for
existence of the POM file. I easily can add the POM file existence test to the
cmd script and print the same errors if the pom file does not exist.
In the cmd script, I need to check for the existence of the extracted
directory because if, for some reason, the directory extracted doesn't exist
(e.g., a bug in the extraction code), the user gets a cryptic error. The same
is not true for the sh script.
I will add the redundant check to the sh script too just for symmetry
purposes...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]