maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agud...@apache.org
Subject maven git commit: MNG-5767 .mvn/ for project specific jvm options and maven parameters -- adapted Windows .bat scripts
Date Wed, 25 Feb 2015 20:58:57 GMT
Repository: maven
Updated Branches:
  refs/heads/master e28be4d33 -> 562896a19


MNG-5767 .mvn/ for project specific jvm options and maven parameters -- adapted Windows .bat
scripts


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

Branch: refs/heads/master
Commit: 562896a192072b9044a6b2fd37ff31bf638214c8
Parents: e28be4d
Author: Andreas Gudian <agudian@apache.org>
Authored: Wed Feb 25 21:58:29 2015 +0100
Committer: Andreas Gudian <agudian@apache.org>
Committed: Wed Feb 25 21:58:29 2015 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn.bat      | 44 +++++++++++++++++++++++++++-
 apache-maven/src/bin/mvnDebug.bat | 53 ++++++++++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/562896a1/apache-maven/src/bin/mvn.bat
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.bat b/apache-maven/src/bin/mvn.bat
index 9540492..abf793b 100644
--- a/apache-maven/src/bin/mvn.bat
+++ b/apache-maven/src/bin/mvn.bat
@@ -141,6 +141,48 @@ goto Win9xApp
 
 @REM Reaching here means variables are defined and arguments have been captured
 :endInit
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+if NOT "%OS%"=="Windows_NT" goto Win9xAdditionalConfig
+
+setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS!
%%a
+endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+goto endReadAdditionalConfig
+
+:Win9xAdditionalConfig
+@REM -- Win9x can only read the first line of the file
+set /P JVM_CONFIG_MAVEN_PROPS=<"%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config"
+ 
+:endReadAdditionalConfig
+
 SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
 
 @REM -- 4NT shell
@@ -158,7 +200,7 @@ goto runm2
 @REM Start MAVEN2
 :runm2
 set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
"-Dmaven.home=%M2_HOME%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
"-Dmaven.home=%M2_HOME%" "-Dmaven.projectBasedir=%MAVEN_PROJECTBASEDIR%" %CLASSWORLDS_LAUNCHER%
%MAVEN_CMD_LINE_ARGS%
 if ERRORLEVEL 1 goto error
 goto end
 

http://git-wip-us.apache.org/repos/asf/maven/blob/562896a1/apache-maven/src/bin/mvnDebug.bat
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvnDebug.bat b/apache-maven/src/bin/mvnDebug.bat
index b7b42b9..2b2cc18 100644
--- a/apache-maven/src/bin/mvnDebug.bat
+++ b/apache-maven/src/bin/mvnDebug.bat
@@ -62,7 +62,7 @@ if not "%JAVA_HOME%" == "" goto OkJHome
 echo.
 echo Error: JAVA_HOME not found in your environment. >&2
 echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation >&2
+echo location of your Java installation. >&2
 echo.
 goto error
 
@@ -73,7 +73,7 @@ echo.
 echo Error: JAVA_HOME is set to an invalid directory. >&2
 echo JAVA_HOME = "%JAVA_HOME%" >&2
 echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation >&2
+echo location of your Java installation. >&2
 echo.
 goto error
 
@@ -87,7 +87,7 @@ if not "%M2_HOME%"=="" goto valMHome
 echo.
 echo Error: M2_HOME not found in your environment. >&2
 echo Please set the M2_HOME variable in your environment to match the >&2
-echo location of the Maven installation >&2
+echo location of the Maven installation. >&2
 echo.
 goto error
 
@@ -145,6 +145,48 @@ goto Win9xApp
 
 @REM Reaching here means variables are defined and arguments have been captured
 :endInit
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+if NOT "%OS%"=="Windows_NT" goto Win9xAdditionalConfig
+
+setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS!
%%a
+endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+goto endReadAdditionalConfig
+
+:Win9xAdditionalConfig
+@REM -- Win9x can only read the first line of the file
+set /P JVM_CONFIG_MAVEN_PROPS=<"%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config"
+ 
+:endReadAdditionalConfig
+
 SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
 
 @REM -- 4NT shell
@@ -162,7 +204,7 @@ goto runm2
 @REM Start MAVEN2
 :runm2
 set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-%MAVEN_JAVA_EXE% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
"-Dmaven.home=%M2_HOME%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR%
"-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" "-Dmaven.projectBasedir=%MAVEN_PROJECTBASEDIR%"
%CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
 if ERRORLEVEL 1 goto error
 goto end
 
@@ -196,5 +238,6 @@ if "%MAVEN_BATCH_PAUSE%" == "on" pause
 
 if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
 
-exit /B %ERROR_CODE%
+cmd /C exit /B %ERROR_CODE%
+
 


Mime
View raw message