You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/11/14 22:12:30 UTC

maven git commit: MNG-5889 - adding logic that looks for the file argument and starts the search for the .mvn directory at the location of the specified POM when present

Repository: maven
Updated Branches:
  refs/heads/master 93a71e2de -> da5b4df93


MNG-5889 - adding logic that looks for the file argument and starts the
search for the .mvn directory at the location of the specified POM when
present


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/da5b4df9
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/da5b4df9
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/da5b4df9

Branch: refs/heads/master
Commit: da5b4df930925a0cbee95cfdca5c249ff143d91b
Parents: 93a71e2
Author: robert.patrick <ro...@oracle.com>
Authored: Thu Sep 15 09:53:06 2016 -0500
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Mon Nov 14 22:28:55 2016 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn     | 31 +++++++++++++++++++--
 apache-maven/src/bin/mvn.cmd | 58 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 83 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index ff6f250..e795073 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -121,7 +121,7 @@ fi
 # first directory with .mvn subdirectory is considered project base directory
 find_maven_basedir() {
 (
-  basedir="`pwd`"
+  basedir=`find_file_argument_basedir "$@"`
   wdir="`pwd`"
   while [ "$wdir" != '/' ] ; do
     if [ -d "$wdir"/.mvn ] ; then
@@ -134,6 +134,33 @@ find_maven_basedir() {
 )
 }
 
+find_file_argument_basedir() {
+(
+  basedir="`pwd`"
+
+  found_file_switch=0
+  for arg in "$@"; do
+    if [ ${found_file_switch} -eq 1 ]; then
+      if [ -f ${arg} ]; then
+        basedir=$(dirname $(readlink -f "${arg}"))
+        if [ ! -d ${basedir} ]; then
+          echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
+          exit 1
+        fi
+      else
+        echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
+        exit 1
+      fi
+      break
+    fi
+    if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
+      found_file_switch=1
+    fi
+  done
+  echo "${basedir}"
+)
+}
+
 # concatenates all lines of a file
 concat_lines() {
   if [ -f "$1" ]; then
@@ -141,7 +168,7 @@ concat_lines() {
   fi
 }
 
-MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}"
+MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
 MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
 
 # For Cygwin, switch project base directory path to Windows format before

http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index cd81e42..21829fa 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -86,19 +86,69 @@ 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
+)
+if not exist "%FILE_ARG%" (
+  echo POM file %FILE_ARG% specified the -f/--file command-line argument does not exist >&2
+  goto error
+)
+call :get_directory_from_file %FILE_ARG%
+if not exist "%POM_DIR%" (
+  echo Directory %POM_DIR% extracted from the -f/--file command-line argument %FILE_ARG% does not exist >&2
+  goto error
+)
+set WDIR=%POM_DIR%
+goto findBaseDir
+
+:get_directory_from_file
+set "POM_DIR=%~dp1"
+:stripPomDir
+if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
+set "POM_DIR=%POM_DIR:~0,-1%"
+goto stripPomDir
+:pomDirStripped
+exit /b
 
 :findBaseDir
+cd /d %WDIR%
+:findBaseDirLoop
 if exist "%WDIR%\.mvn" goto baseDirFound
 cd ..
 if "%WDIR%"=="%CD%" goto baseDirNotFound
 set "WDIR=%CD%"
-goto findBaseDir
+goto findBaseDirLoop
 
 :baseDirFound
 set "MAVEN_PROJECTBASEDIR=%WDIR%"
-cd "%EXEC_DIR%"
+cd /d "%EXEC_DIR%"
 goto endDetectBaseDir
 
 :baseDirNotFound


Re: maven git commit: MNG-5889 - adding logic that looks for the file argument and starts the search for the .mvn directory at the location of the specified POM when present

Posted by he...@free.fr.
I completely overlooked the failing IT on Windows: thanks for fixing
On ASF Jenkins, MavenITmng3599useHttpProxyForWebDAVTest.testitUseHttpProxyForWebDAV looks flaky: sometimes it passes, but fails in general. Any idea?

regarding MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest, it was fixed when you fixed the cmd issue: MavenITmng3599useHttpProxyForWebDAVTest is the only failing IT currently
https://builds.apache.org/view/M-R/view/Maven/job/core-it-maven-3-win/lastCompletedBuild/testReport/

is MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest flaky?

Regards,

Hervé

----- Mail original -----
De: "Guillaume Boué" <gb...@apache.org>
À: commits@maven.apache.org, "Maven Developers List" <de...@maven.apache.org>
Envoyé: Jeudi 17 Novembre 2016 16:58:53
Objet: Re: maven git commit: MNG-5889 - adding logic that looks for the file argument and starts the search for the .mvn directory at the location of the specified POM when present

Hi,

This caused some ITs to fail on Windows, which I fixed in commit 8ae1a3e9.

There is still one failing IT: 
MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest. It fails with 
master and Java 8 (on my machine). Looking at the code, it seems more of 
an issue with the test that the script itself. I'm not sure why it 
started to fail in build #1372. Was there a Java version change on Jenkins?

Thanks,
Guillaume

Le 14/11/2016 à 23:12, hboutemy@apache.org a écrit :
> Repository: maven
> Updated Branches:
>    refs/heads/master 93a71e2de -> da5b4df93
>
>
> MNG-5889 - adding logic that looks for the file argument and starts the
> search for the .mvn directory at the location of the specified POM when
> present
>
>
> Project: http://git-wip-us.apache.org/repos/asf/maven/repo
> Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/da5b4df9
> Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/da5b4df9
> Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/da5b4df9
>
> Branch: refs/heads/master
> Commit: da5b4df930925a0cbee95cfdca5c249ff143d91b
> Parents: 93a71e2
> Author: robert.patrick <ro...@oracle.com>
> Authored: Thu Sep 15 09:53:06 2016 -0500
> Committer: Hervé Boutemy <hb...@apache.org>
> Committed: Mon Nov 14 22:28:55 2016 +0100
>
> ----------------------------------------------------------------------
>   apache-maven/src/bin/mvn     | 31 +++++++++++++++++++--
>   apache-maven/src/bin/mvn.cmd | 58 ++++++++++++++++++++++++++++++++++++---
>   2 files changed, 83 insertions(+), 6 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
> index ff6f250..e795073 100755
> --- a/apache-maven/src/bin/mvn
> +++ b/apache-maven/src/bin/mvn
> @@ -121,7 +121,7 @@ fi
>   # first directory with .mvn subdirectory is considered project base directory
>   find_maven_basedir() {
>   (
> -  basedir="`pwd`"
> +  basedir=`find_file_argument_basedir "$@"`
>     wdir="`pwd`"
>     while [ "$wdir" != '/' ] ; do
>       if [ -d "$wdir"/.mvn ] ; then
> @@ -134,6 +134,33 @@ find_maven_basedir() {
>   )
>   }
>   
> +find_file_argument_basedir() {
> +(
> +  basedir="`pwd`"
> +
> +  found_file_switch=0
> +  for arg in "$@"; do
> +    if [ ${found_file_switch} -eq 1 ]; then
> +      if [ -f ${arg} ]; then
> +        basedir=$(dirname $(readlink -f "${arg}"))
> +        if [ ! -d ${basedir} ]; then
> +          echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
> +          exit 1
> +        fi
> +      else
> +        echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
> +        exit 1
> +      fi
> +      break
> +    fi
> +    if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
> +      found_file_switch=1
> +    fi
> +  done
> +  echo "${basedir}"
> +)
> +}
> +
>   # concatenates all lines of a file
>   concat_lines() {
>     if [ -f "$1" ]; then
> @@ -141,7 +168,7 @@ concat_lines() {
>     fi
>   }
>   
> -MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}"
> +MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
>   MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
>   
>   # For Cygwin, switch project base directory path to Windows format before
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn.cmd
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
> index cd81e42..21829fa 100644
> --- a/apache-maven/src/bin/mvn.cmd
> +++ b/apache-maven/src/bin/mvn.cmd
> @@ -86,19 +86,69 @@ 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
> +)
> +if not exist "%FILE_ARG%" (
> +  echo POM file %FILE_ARG% specified the -f/--file command-line argument does not exist >&2
> +  goto error
> +)
> +call :get_directory_from_file %FILE_ARG%
> +if not exist "%POM_DIR%" (
> +  echo Directory %POM_DIR% extracted from the -f/--file command-line argument %FILE_ARG% does not exist >&2
> +  goto error
> +)
> +set WDIR=%POM_DIR%
> +goto findBaseDir
> +
> +:get_directory_from_file
> +set "POM_DIR=%~dp1"
> +:stripPomDir
> +if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
> +set "POM_DIR=%POM_DIR:~0,-1%"
> +goto stripPomDir
> +:pomDirStripped
> +exit /b
>   
>   :findBaseDir
> +cd /d %WDIR%
> +:findBaseDirLoop
>   if exist "%WDIR%\.mvn" goto baseDirFound
>   cd ..
>   if "%WDIR%"=="%CD%" goto baseDirNotFound
>   set "WDIR=%CD%"
> -goto findBaseDir
> +goto findBaseDirLoop
>   
>   :baseDirFound
>   set "MAVEN_PROJECTBASEDIR=%WDIR%"
> -cd "%EXEC_DIR%"
> +cd /d "%EXEC_DIR%"
>   goto endDetectBaseDir
>   
>   :baseDirNotFound
>


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven git commit: MNG-5889 - adding logic that looks for the file argument and starts the search for the .mvn directory at the location of the specified POM when present

Posted by Guillaume Boué <gb...@apache.org>.
Hi,

This caused some ITs to fail on Windows, which I fixed in commit 8ae1a3e9.

There is still one failing IT: 
MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest. It fails with 
master and Java 8 (on my machine). Looking at the code, it seems more of 
an issue with the test that the script itself. I'm not sure why it 
started to fail in build #1372. Was there a Java version change on Jenkins?

Thanks,
Guillaume

Le 14/11/2016  23:12, hboutemy@apache.org a crit :
> Repository: maven
> Updated Branches:
>    refs/heads/master 93a71e2de -> da5b4df93
>
>
> MNG-5889 - adding logic that looks for the file argument and starts the
> search for the .mvn directory at the location of the specified POM when
> present
>
>
> Project: http://git-wip-us.apache.org/repos/asf/maven/repo
> Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/da5b4df9
> Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/da5b4df9
> Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/da5b4df9
>
> Branch: refs/heads/master
> Commit: da5b4df930925a0cbee95cfdca5c249ff143d91b
> Parents: 93a71e2
> Author: robert.patrick <ro...@oracle.com>
> Authored: Thu Sep 15 09:53:06 2016 -0500
> Committer: Hervé Boutemy <hb...@apache.org>
> Committed: Mon Nov 14 22:28:55 2016 +0100
>
> ----------------------------------------------------------------------
>   apache-maven/src/bin/mvn     | 31 +++++++++++++++++++--
>   apache-maven/src/bin/mvn.cmd | 58 ++++++++++++++++++++++++++++++++++++---
>   2 files changed, 83 insertions(+), 6 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
> index ff6f250..e795073 100755
> --- a/apache-maven/src/bin/mvn
> +++ b/apache-maven/src/bin/mvn
> @@ -121,7 +121,7 @@ fi
>   # first directory with .mvn subdirectory is considered project base directory
>   find_maven_basedir() {
>   (
> -  basedir="`pwd`"
> +  basedir=`find_file_argument_basedir "$@"`
>     wdir="`pwd`"
>     while [ "$wdir" != '/' ] ; do
>       if [ -d "$wdir"/.mvn ] ; then
> @@ -134,6 +134,33 @@ find_maven_basedir() {
>   )
>   }
>   
> +find_file_argument_basedir() {
> +(
> +  basedir="`pwd`"
> +
> +  found_file_switch=0
> +  for arg in "$@"; do
> +    if [ ${found_file_switch} -eq 1 ]; then
> +      if [ -f ${arg} ]; then
> +        basedir=$(dirname $(readlink -f "${arg}"))
> +        if [ ! -d ${basedir} ]; then
> +          echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
> +          exit 1
> +        fi
> +      else
> +        echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
> +        exit 1
> +      fi
> +      break
> +    fi
> +    if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
> +      found_file_switch=1
> +    fi
> +  done
> +  echo "${basedir}"
> +)
> +}
> +
>   # concatenates all lines of a file
>   concat_lines() {
>     if [ -f "$1" ]; then
> @@ -141,7 +168,7 @@ concat_lines() {
>     fi
>   }
>   
> -MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}"
> +MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
>   MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
>   
>   # For Cygwin, switch project base directory path to Windows format before
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn.cmd
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
> index cd81e42..21829fa 100644
> --- a/apache-maven/src/bin/mvn.cmd
> +++ b/apache-maven/src/bin/mvn.cmd
> @@ -86,19 +86,69 @@ 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
> +)
> +if not exist "%FILE_ARG%" (
> +  echo POM file %FILE_ARG% specified the -f/--file command-line argument does not exist >&2
> +  goto error
> +)
> +call :get_directory_from_file %FILE_ARG%
> +if not exist "%POM_DIR%" (
> +  echo Directory %POM_DIR% extracted from the -f/--file command-line argument %FILE_ARG% does not exist >&2
> +  goto error
> +)
> +set WDIR=%POM_DIR%
> +goto findBaseDir
> +
> +:get_directory_from_file
> +set "POM_DIR=%~dp1"
> +:stripPomDir
> +if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
> +set "POM_DIR=%POM_DIR:~0,-1%"
> +goto stripPomDir
> +:pomDirStripped
> +exit /b
>   
>   :findBaseDir
> +cd /d %WDIR%
> +:findBaseDirLoop
>   if exist "%WDIR%\.mvn" goto baseDirFound
>   cd ..
>   if "%WDIR%"=="%CD%" goto baseDirNotFound
>   set "WDIR=%CD%"
> -goto findBaseDir
> +goto findBaseDirLoop
>   
>   :baseDirFound
>   set "MAVEN_PROJECTBASEDIR=%WDIR%"
> -cd "%EXEC_DIR%"
> +cd /d "%EXEC_DIR%"
>   goto endDetectBaseDir
>   
>   :baseDirNotFound
>


---
L'absence de virus dans ce courrier lectronique a t vrifie par le logiciel antivirus Avast.
https://www.avast.com/antivirus


Re: maven git commit: MNG-5889 - adding logic that looks for the file argument and starts the search for the .mvn directory at the location of the specified POM when present

Posted by Guillaume Boué <gb...@apache.org>.
Hi,

This caused some ITs to fail on Windows, which I fixed in commit 8ae1a3e9.

There is still one failing IT: 
MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest. It fails with 
master and Java 8 (on my machine). Looking at the code, it seems more of 
an issue with the test that the script itself. I'm not sure why it 
started to fail in build #1372. Was there a Java version change on Jenkins?

Thanks,
Guillaume

Le 14/11/2016  23:12, hboutemy@apache.org a crit :
> Repository: maven
> Updated Branches:
>    refs/heads/master 93a71e2de -> da5b4df93
>
>
> MNG-5889 - adding logic that looks for the file argument and starts the
> search for the .mvn directory at the location of the specified POM when
> present
>
>
> Project: http://git-wip-us.apache.org/repos/asf/maven/repo
> Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/da5b4df9
> Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/da5b4df9
> Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/da5b4df9
>
> Branch: refs/heads/master
> Commit: da5b4df930925a0cbee95cfdca5c249ff143d91b
> Parents: 93a71e2
> Author: robert.patrick <ro...@oracle.com>
> Authored: Thu Sep 15 09:53:06 2016 -0500
> Committer: Hervé Boutemy <hb...@apache.org>
> Committed: Mon Nov 14 22:28:55 2016 +0100
>
> ----------------------------------------------------------------------
>   apache-maven/src/bin/mvn     | 31 +++++++++++++++++++--
>   apache-maven/src/bin/mvn.cmd | 58 ++++++++++++++++++++++++++++++++++++---
>   2 files changed, 83 insertions(+), 6 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
> index ff6f250..e795073 100755
> --- a/apache-maven/src/bin/mvn
> +++ b/apache-maven/src/bin/mvn
> @@ -121,7 +121,7 @@ fi
>   # first directory with .mvn subdirectory is considered project base directory
>   find_maven_basedir() {
>   (
> -  basedir="`pwd`"
> +  basedir=`find_file_argument_basedir "$@"`
>     wdir="`pwd`"
>     while [ "$wdir" != '/' ] ; do
>       if [ -d "$wdir"/.mvn ] ; then
> @@ -134,6 +134,33 @@ find_maven_basedir() {
>   )
>   }
>   
> +find_file_argument_basedir() {
> +(
> +  basedir="`pwd`"
> +
> +  found_file_switch=0
> +  for arg in "$@"; do
> +    if [ ${found_file_switch} -eq 1 ]; then
> +      if [ -f ${arg} ]; then
> +        basedir=$(dirname $(readlink -f "${arg}"))
> +        if [ ! -d ${basedir} ]; then
> +          echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
> +          exit 1
> +        fi
> +      else
> +        echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
> +        exit 1
> +      fi
> +      break
> +    fi
> +    if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
> +      found_file_switch=1
> +    fi
> +  done
> +  echo "${basedir}"
> +)
> +}
> +
>   # concatenates all lines of a file
>   concat_lines() {
>     if [ -f "$1" ]; then
> @@ -141,7 +168,7 @@ concat_lines() {
>     fi
>   }
>   
> -MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}"
> +MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
>   MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
>   
>   # For Cygwin, switch project base directory path to Windows format before
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/da5b4df9/apache-maven/src/bin/mvn.cmd
> ----------------------------------------------------------------------
> diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
> index cd81e42..21829fa 100644
> --- a/apache-maven/src/bin/mvn.cmd
> +++ b/apache-maven/src/bin/mvn.cmd
> @@ -86,19 +86,69 @@ 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
> +)
> +if not exist "%FILE_ARG%" (
> +  echo POM file %FILE_ARG% specified the -f/--file command-line argument does not exist >&2
> +  goto error
> +)
> +call :get_directory_from_file %FILE_ARG%
> +if not exist "%POM_DIR%" (
> +  echo Directory %POM_DIR% extracted from the -f/--file command-line argument %FILE_ARG% does not exist >&2
> +  goto error
> +)
> +set WDIR=%POM_DIR%
> +goto findBaseDir
> +
> +:get_directory_from_file
> +set "POM_DIR=%~dp1"
> +:stripPomDir
> +if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
> +set "POM_DIR=%POM_DIR:~0,-1%"
> +goto stripPomDir
> +:pomDirStripped
> +exit /b
>   
>   :findBaseDir
> +cd /d %WDIR%
> +:findBaseDirLoop
>   if exist "%WDIR%\.mvn" goto baseDirFound
>   cd ..
>   if "%WDIR%"=="%CD%" goto baseDirNotFound
>   set "WDIR=%CD%"
> -goto findBaseDir
> +goto findBaseDirLoop
>   
>   :baseDirFound
>   set "MAVEN_PROJECTBASEDIR=%WDIR%"
> -cd "%EXEC_DIR%"
> +cd /d "%EXEC_DIR%"
>   goto endDetectBaseDir
>   
>   :baseDirNotFound
>


---
L'absence de virus dans ce courrier lectronique a t vrifie par le logiciel antivirus Avast.
https://www.avast.com/antivirus


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org