[
https://issues.apache.org/jira/browse/MNG-5889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15639827#comment-15639827
]
ASF GitHub Bot commented on MNG-5889:
-------------------------------------
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...
> .mvn directory should be picked when using --file
> -------------------------------------------------
>
> Key: MNG-5889
> URL: https://issues.apache.org/jira/browse/MNG-5889
> Project: Maven
> Issue Type: Improvement
> Components: Bootstrap & Build
> Affects Versions: 3.3.3
> Reporter: Daniel Spilker
> Assignee: Tibor Digana
> Fix For: 3.4.0
>
>
> The {{.mvn}} directory is not picked up when using the {{--file}} switch to
> build a project from outside of the multi-module root.
> Example:
> * the module root is {{/foo/bar}}
> * {{.mvn}} is located at {{/foo/bar/.mvn}}
> * current directory is {{/foo}}
> * Maven is invoked with {{mvn --file bar/module/pom.xml}}
> I would expect the {{.mvn}} directory detection to start at the directory of
> the POM selected by {{--file}} and then go through the parent directories.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)