You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/05/17 19:52:07 UTC

[maven] branch MNG-5937 updated: Align Windows scripts

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MNG-5937
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/MNG-5937 by this push:
     new fd2dc67  Align Windows scripts
fd2dc67 is described below

commit fd2dc67d629eea594c4ca8eeb63cdfe21786f7f3
Author: rfscholte <rf...@apache.org>
AuthorDate: Sun May 17 21:50:07 2020 +0200

    Align Windows scripts
---
 apache-maven/maven-wrapper.pom                     |   4 +
 apache-maven/pom.xml                               |   4 +
 apache-maven/src/assembly/maven/bin/mvn.cmd        | 201 ---------------------
 apache-maven/src/assembly/maven/component.xml      |  32 +++-
 apache-maven/src/assembly/shared/init              |   2 -
 apache-maven/src/assembly/shared/init.cmd          | 166 ++++++++---------
 apache-maven/src/assembly/shared/mvnlauncher       |   3 +
 apache-maven/src/assembly/shared/mvnlauncher.cmd   |   7 +
 apache-maven/src/assembly/shared/mvnvalidate.cmd   |   8 +
 apache-maven/src/assembly/shared/mvnwlauncher      |   4 +-
 apache-maven/src/assembly/shared/mvnwlauncher.cmd  |   6 +-
 apache-maven/src/assembly/shared/run               |   7 +-
 apache-maven/src/assembly/shared/run.cmd           |  25 +--
 apache-maven/src/assembly/shared/validate.cmd      |  63 +++++++
 apache-maven/src/assembly/wrapper/bin.xml          |   1 +
 apache-maven/src/assembly/wrapper/script.xml       |   1 +
 .../src/assembly/wrapper/script/download.cmd       |  10 +-
 apache-maven/src/assembly/wrapper/source.xml       |   1 +
 .../src/assembly/wrapper/source/download.cmd       |   4 -
 19 files changed, 222 insertions(+), 327 deletions(-)

diff --git a/apache-maven/maven-wrapper.pom b/apache-maven/maven-wrapper.pom
index c35a0cd..0790ab5 100644
--- a/apache-maven/maven-wrapper.pom
+++ b/apache-maven/maven-wrapper.pom
@@ -43,6 +43,10 @@ under the License.
             <excludes combine.children="append">
               <exclude>src/assembly/maven/bin/m2.conf</exclude>
               <!-- these are partial scripts, resulting in mvn/mwnw scripts -->
+              <exclude>src/assembly/shared/init.cmd</exclude>
+              <exclude>src/assembly/shared/mvnlauncher</exclude>
+              <exclude>src/assembly/shared/mvnlauncher.cmd</exclude>
+              <exclude>src/assembly/shared/mvnvalidate.cmd</exclude>
               <exclude>src/assembly/shared/mvnwlauncher</exclude>
               <exclude>src/assembly/shared/mvnwlauncher.cmd</exclude>
               <exclude>src/assembly/shared/run</exclude>
diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index d0271d0..53c9bc6 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -130,6 +130,10 @@ under the License.
             <excludes combine.children="append">
               <exclude>src/assembly/maven/bin/m2.conf</exclude>
               <!-- these are partial scripts, resulting in mvn/mwnw scripts -->
+              <exclude>src/assembly/shared/init.cmd</exclude>
+              <exclude>src/assembly/shared/mvnlauncher</exclude>
+              <exclude>src/assembly/shared/mvnlauncher.cmd</exclude>
+              <exclude>src/assembly/shared/mvnvalidate.cmd</exclude>
               <exclude>src/assembly/shared/mvnwlauncher</exclude>
               <exclude>src/assembly/shared/mvnwlauncher.cmd</exclude>
               <exclude>src/assembly/shared/run</exclude>
diff --git a/apache-maven/src/assembly/maven/bin/mvn.cmd b/apache-maven/src/assembly/maven/bin/mvn.cmd
deleted file mode 100644
index 50dafc7..0000000
--- a/apache-maven/src/assembly/maven/bin/mvn.cmd
+++ /dev/null
@@ -1,201 +0,0 @@
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements.  See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership.  The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License.  You may obtain a copy of the License at
-@REM
-@REM    http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied.  See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-
-@REM -----------------------------------------------------------------------------
-@REM Apache Maven Startup Script
-@REM
-@REM Environment Variable Prerequisites
-@REM
-@REM   JAVA_HOME          Must point at your Java Development Kit installation.
-@REM   MAVEN_BATCH_ECHO  (Optional) Set to 'on' to enable the echoing of the batch commands.
-@REM   MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
-@REM   MAVEN_OPTS        (Optional) Java runtime options used when Maven is executed.
-@REM   MAVEN_SKIP_RC     (Optional) Flag to disable loading of mavenrc files.
-@REM -----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat"
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%"=="" goto OkJHome
-for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
-goto checkJCmd
-
-:OkJHome
-set "JAVACMD=%JAVA_HOME%\bin\java.exe"
-
-:checkJCmd
-if exist "%JAVACMD%" goto chkMHome
-
-echo The JAVA_HOME environment variable is not defined correctly >&2
-echo This environment variable is needed to run this program >&2
-echo NB: JAVA_HOME should point to a JDK not a JRE >&2
-goto error
-
-:chkMHome
-set "MAVEN_HOME=%~dp0"
-set "MAVEN_HOME=%MAVEN_HOME:~0,-5%"
-if not "%MAVEN_HOME%"=="" goto checkMCmd
-goto error
-
-:checkMCmd
-if exist "%MAVEN_HOME%\bin\mvn.cmd" goto init
-goto error
-@REM ==== END VALIDATION ====
-
-:init
-
-set MAVEN_CMD_LINE_ARGS=%*
-
-@REM Find the project basedir, 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%"
-
-@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
-)
-if exist "%FILE_ARG%\*" (
-  set "POM_DIR=%FILE_ARG%"
-) else (
-  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 findBaseDirLoop
-
-:baseDirFound
-set "MAVEN_PROJECTBASEDIR=%WDIR%"
-cd /d "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-if "_%EXEC_DIR:~-1%"=="_\" set "EXEC_DIR=%EXEC_DIR:~0,-1%"
-set "MAVEN_PROJECTBASEDIR=%EXEC_DIR%"
-cd /d "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-set "jvmConfig=\.mvn\jvm.config"
-if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%" goto endReadAdditionalConfig
-
-@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%
-
-:endReadAdditionalConfig
-
-for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%%i"
-set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-"%JAVACMD%" ^
-  %JVM_CONFIG_MAVEN_PROPS% ^
-  %MAVEN_OPTS% ^
-  %MAVEN_DEBUG_OPTS% ^
-  -classpath %CLASSWORLDS_JAR% ^
-  "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
-  "-Dmaven.home=%MAVEN_HOME%" ^
-  "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native" ^
-  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
-  %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
diff --git a/apache-maven/src/assembly/maven/component.xml b/apache-maven/src/assembly/maven/component.xml
index 5cbf5d1..9114c50 100644
--- a/apache-maven/src/assembly/maven/component.xml
+++ b/apache-maven/src/assembly/maven/component.xml
@@ -16,8 +16,8 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-<component xmlns="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0 http://maven.apache.org/xsd/assembly-component-2.0.0.xsd">
+<component xmlns="http://maven.apache.org/ASSEMBLY-COMPONENT/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/ASSEMBLY-COMPONENT/2.1.0 http://maven.apache.org/xsd/assembly-component-2.1.0.xsd">
   <dependencySets>
     <dependencySet>
       <useProjectArtifact>false</useProjectArtifact>
@@ -101,4 +101,32 @@ under the License.
       <outputDirectory>lib</outputDirectory>
     </fileSet>
   </fileSets>
+  
+  <files>
+    <file>
+      <sources>
+        <source>src/assembly/shared/validate.cmd</source>
+        <source>src/assembly/shared/mvnvalidate.cmd</source>
+        <source>src/assembly/shared/init.cmd</source>
+        <source>src/assembly/shared/mvnlauncher.cmd</source>
+        <source>src/assembly/shared/run.cmd</source>
+      </sources>
+      <destName>mvn.cmd</destName>
+      <outputDirectory>bin</outputDirectory>
+      <lineEnding>dos</lineEnding>
+      <filtered>true</filtered>
+    </file>
+    <file>
+      <sources>
+        <source>src/assembly/shared/init</source>
+        <source>src/assembly/shared/mvnlauncher</source>
+        <source>src/assembly/shared/run</source>
+      </sources>
+      <destName>mvn3</destName>
+      <outputDirectory>bin</outputDirectory>
+      <lineEnding>unix</lineEnding>
+      <fileMode>0755</fileMode>
+      <filtered>true</filtered>
+    </file>
+  </files>
 </component>
diff --git a/apache-maven/src/assembly/shared/init b/apache-maven/src/assembly/shared/init
index 9ca78a2..d15889e 100755
--- a/apache-maven/src/assembly/shared/init
+++ b/apache-maven/src/assembly/shared/init
@@ -160,8 +160,6 @@ if [ -z "$JAVA_HOME" ] ; then
   echo "Warning: JAVA_HOME environment variable is not set."
 fi
 
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
 # traverses directory structure from process work directory to filesystem root
 # first directory with .mvn subdirectory is considered project base directory
 find_maven_basedir() {
diff --git a/apache-maven/src/assembly/shared/init.cmd b/apache-maven/src/assembly/shared/init.cmd
index 187013e..14ec5ba 100755
--- a/apache-maven/src/assembly/shared/init.cmd
+++ b/apache-maven/src/assembly/shared/init.cmd
@@ -1,114 +1,93 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements.  See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership.  The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License.  You may obtain a copy of the License at
-@REM
-@REM    http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied.  See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM     e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-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.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-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.
-goto error
-
 @REM ==== END VALIDATION ====
 
 :init
 
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+set MAVEN_CMD_LINE_ARGS=%*
+
+@REM Find the project basedir, 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 "MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%"
+if not "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+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
+)
+if exist "%FILE_ARG%\*" (
+  set "POM_DIR=%FILE_ARG%"
+) else (
+  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
 
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
 :findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd /d "%WDIR%"
+:findBaseDirLoop
+if exist "%WDIR%\.mvn" goto baseDirFound
 cd ..
 IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
+set "WDIR=%CD%"
+goto findBaseDirLoop
 
 :baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
+set "MAVEN_PROJECTBASEDIR=%WDIR%"
+cd /d "%EXEC_DIR%"
 goto endDetectBaseDir
 
 :baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
+if "_%EXEC_DIR:~-1%"=="_\" set "EXEC_DIR=%EXEC_DIR:~0,-1%"
+set "MAVEN_PROJECTBASEDIR=%EXEC_DIR%"
+cd /d "%EXEC_DIR%"
 
 :endDetectBaseDir
 
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+set "jvmConfig=\.mvn\jvm.config"
+if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%" goto endReadAdditionalConfig
 
 @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
@@ -116,4 +95,3 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
 
 :endReadAdditionalConfig
 
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
diff --git a/apache-maven/src/assembly/shared/mvnlauncher b/apache-maven/src/assembly/shared/mvnlauncher
new file mode 100644
index 0000000..51cf73f
--- /dev/null
+++ b/apache-maven/src/assembly/shared/mvnlauncher
@@ -0,0 +1,3 @@
+LAUNCHER_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
+MAVEN_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+ 
diff --git a/apache-maven/src/assembly/shared/mvnlauncher.cmd b/apache-maven/src/assembly/shared/mvnlauncher.cmd
new file mode 100644
index 0000000..8ee3c47
--- /dev/null
+++ b/apache-maven/src/assembly/shared/mvnlauncher.cmd
@@ -0,0 +1,7 @@
+for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set LAUNCHER_JAR="%%i"
+set MAVEN_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+set MAVENHOME_CONFIG= "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" "-Dmaven.home=%MAVEN_HOME%" "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native"
+
+set CLASSWORLDS_LAUNCHER=${MAVEN_LAUNCHER}
+set CLASSWORLDS_JAR=${LAUNCHER_JAR}
+
diff --git a/apache-maven/src/assembly/shared/mvnvalidate.cmd b/apache-maven/src/assembly/shared/mvnvalidate.cmd
new file mode 100644
index 0000000..cf1b2dd
--- /dev/null
+++ b/apache-maven/src/assembly/shared/mvnvalidate.cmd
@@ -0,0 +1,8 @@
+:chkMHome
+set "MAVEN_HOME=%~dp0"
+set "MAVEN_HOME=%MAVEN_HOME:~0,-5%"
+if "%MAVEN_HOME%"=="" goto error
+
+:checkMCmd
+if not exist "%MAVEN_HOME%\bin\mvn.cmd" goto error
+
diff --git a/apache-maven/src/assembly/shared/mvnwlauncher b/apache-maven/src/assembly/shared/mvnwlauncher
index 031dca5..42029dc 100755
--- a/apache-maven/src/assembly/shared/mvnwlauncher
+++ b/apache-maven/src/assembly/shared/mvnwlauncher
@@ -1,3 +1,3 @@
-WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%/.mvn/wrapper/maven-wrapper.jar"
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+LAUNCHER_JAR="%MAVEN_PROJECTBASEDIR%/.mvn/wrapper/maven-wrapper.jar"
+MAVEN_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
 
diff --git a/apache-maven/src/assembly/shared/mvnwlauncher.cmd b/apache-maven/src/assembly/shared/mvnwlauncher.cmd
index 337b12a..1a12b03 100755
--- a/apache-maven/src/assembly/shared/mvnwlauncher.cmd
+++ b/apache-maven/src/assembly/shared/mvnwlauncher.cmd
@@ -1,3 +1,3 @@
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
+set LAUNCHER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set MAVEN_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+set MAVENHOME_CONFIG=
diff --git a/apache-maven/src/assembly/shared/run b/apache-maven/src/assembly/shared/run
index 80f0ab8..3802d8f 100755
--- a/apache-maven/src/assembly/shared/run
+++ b/apache-maven/src/assembly/shared/run
@@ -5,6 +5,7 @@ export MAVEN_CMD_LINE_ARGS
 
 exec "$JAVACMD" \
   $MAVEN_OPTS \
-  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
-  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
-  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
+  -classpath ${LAUNCHER_JAR} \
+  $MAVENHOME_CONFIG \ 
+  "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  $MAVEN_LAUNCHER $MAVEN_CONFIG "$@"
diff --git a/apache-maven/src/assembly/shared/run.cmd b/apache-maven/src/assembly/shared/run.cmd
index 6d33223..99d999d 100755
--- a/apache-maven/src/assembly/shared/run.cmd
+++ b/apache-maven/src/assembly/shared/run.cmd
@@ -1,8 +1,11 @@
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+"%JAVACMD%" ^
+  %JVM_CONFIG_MAVEN_PROPS% ^
+  %MAVEN_OPTS% ^
+  %MAVEN_DEBUG_OPTS% ^
+  -classpath %LAUNCHER_JAR% ^
+  %MAVENHOME_CONFIG% ^
+  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+  %MAVEN_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
 if ERRORLEVEL 1 goto error
 goto end
 
@@ -12,15 +15,15 @@ set ERROR_CODE=1
 :end
 @endlocal & set ERROR_CODE=%ERROR_CODE%
 
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
 @REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
 :skipRcPost
 
 @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
 
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
 
-exit /B %ERROR_CODE%
\ No newline at end of file
+cmd /C exit /B %ERROR_CODE%
diff --git a/apache-maven/src/assembly/shared/validate.cmd b/apache-maven/src/assembly/shared/validate.cmd
new file mode 100644
index 0000000..7c98ab9
--- /dev/null
+++ b/apache-maven/src/assembly/shared/validate.cmd
@@ -0,0 +1,63 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Startup Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM   JAVA_HOME          Must point at your Java Development Kit installation.
+@REM   MAVEN_BATCH_ECHO  (Optional) Set to 'on' to enable the echoing of the batch commands.
+@REM   MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
+@REM   MAVEN_OPTS        (Optional) Java runtime options used when Maven is executed.
+@REM   MAVEN_SKIP_RC     (Optional) Flag to disable loading of mavenrc files.
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat"
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%"=="" goto OkJHome
+for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
+goto checkJCmd
+
+:OkJHome
+set "JAVACMD=%JAVA_HOME%\bin\java.exe"
+
+:checkJCmd
+if not exist "%JAVACMD%" (
+  echo The JAVA_HOME environment variable is not defined correctly >&2
+  echo This environment variable is needed to run this program >&2
+  echo NB: JAVA_HOME should point to a JDK not a JRE >&2
+  goto error
+)
+
diff --git a/apache-maven/src/assembly/wrapper/bin.xml b/apache-maven/src/assembly/wrapper/bin.xml
index 313a62b..0a9270b 100644
--- a/apache-maven/src/assembly/wrapper/bin.xml
+++ b/apache-maven/src/assembly/wrapper/bin.xml
@@ -52,6 +52,7 @@ under the License.
     </file>
     <file>
       <sources>
+        <source>src/assembly/shared/validate.cmd</source>
         <source>src/assembly/shared/init.cmd</source>
         <source>src/assembly/shared/mvnwlauncher.cmd</source>
         <source>src/assembly/shared/run.cmd</source>
diff --git a/apache-maven/src/assembly/wrapper/script.xml b/apache-maven/src/assembly/wrapper/script.xml
index a850e48..066078d 100644
--- a/apache-maven/src/assembly/wrapper/script.xml
+++ b/apache-maven/src/assembly/wrapper/script.xml
@@ -42,6 +42,7 @@ under the License.
     </file>
     <file>
       <sources>
+        <source>src/assembly/shared/validate.cmd</source>
         <source>src/assembly/shared/init.cmd</source>
         <source>src/assembly/shared/mvnwlauncher.cmd</source>
         <source>src/assembly/wrapper/script/download.cmd</source>
diff --git a/apache-maven/src/assembly/wrapper/script/download.cmd b/apache-maven/src/assembly/wrapper/script/download.cmd
index b69f533..998dda5 100755
--- a/apache-maven/src/assembly/wrapper/script/download.cmd
+++ b/apache-maven/src/assembly/wrapper/script/download.cmd
@@ -1,8 +1,8 @@
 @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
 @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-IF NOT EXIST %WRAPPER_JAR% goto downloadWrapper
+IF NOT EXIST %LAUNCHER_JAR% goto downloadWrapper
 
-if "%MVNW_VERBOSE%" == "true" ECHO Found %WRAPPER_JAR%
+if "%MVNW_VERBOSE%" == "true" ECHO Found %LAUNCHER_JAR%
 goto endWrapper
 
 :downloadWrapper
@@ -16,7 +16,7 @@ if not "%MVNW_REPOURL%" == "" (
     SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/maven-wrapper/${project.version}/maven-wrapper-${project.version}.jar"
 )
 if "%MVNW_VERBOSE%" == "true" (
-    echo Couldn't find %WRAPPER_JAR%, downloading it ...
+    echo Couldn't find %LAUNCHER_JAR%, downloading it ...
     echo Downloading from: %DOWNLOAD_URL%
 )
 
@@ -25,10 +25,10 @@ powershell -Command "&{"^
 	"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
 	"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
 	"}"^
-	"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+	"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%LAUNCHER_JAR%')"^
 	"}"
 if "%MVNW_VERBOSE%" == "true" (
-    echo Finished downloading %WRAPPER_JAR%
+    echo Finished downloading %LAUNCHER_JAR%
 )
 
 :endWrapper
diff --git a/apache-maven/src/assembly/wrapper/source.xml b/apache-maven/src/assembly/wrapper/source.xml
index 0560f2b..6dd16a7 100644
--- a/apache-maven/src/assembly/wrapper/source.xml
+++ b/apache-maven/src/assembly/wrapper/source.xml
@@ -42,6 +42,7 @@ under the License.
     </file>
     <file>
       <sources>
+        <source>src/assembly/shared/validate.cmd</source>
         <source>src/assembly/shared/init.cmd</source>
         <source>src/assembly/shared/mvnwlauncher.cmd</source>
         <source>src/assembly/wrapper/source/download.cmd</source>
diff --git a/apache-maven/src/assembly/wrapper/source/download.cmd b/apache-maven/src/assembly/wrapper/source/download.cmd
index d626e13..28d1349 100644
--- a/apache-maven/src/assembly/wrapper/source/download.cmd
+++ b/apache-maven/src/assembly/wrapper/source/download.cmd
@@ -1,7 +1,3 @@
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
 @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
 @REM This allows using the maven wrapper in projects that prohibit checking in binary data.