This repository was archived by the owner on Jan 19, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed
maven-wrapper-distribution/src/assembly/maven
maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper
maven-wrapper/src/main/java/org/apache/maven/wrapper Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ if $cygwin || $mingw ; then
88 MAVEN_PROJECTBASEDIR=`cygpath --windows "$MAVEN_PROJECTBASEDIR"`
99fi
1010
11- exec "$JAVACMD" \
11+ "$JAVACMD" \
1212 $MAVEN_OPTS \
1313 $MAVEN_DEBUG_OPTS \
1414 -classpath "$LAUNCHER_JAR" \
@@ -17,3 +17,17 @@ exec "$JAVACMD" \
1717 "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
1818 "-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR" \
1919 $LAUNCHER_CLASS "$@"
20+
21+ # read distributionUrl from $MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties
22+ while IFS="=" read key value; do
23+ case "$key" in (distributionUrl) distributionUrl="$value"; break ;;
24+ esac
25+ done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
26+
27+ # local distribution dir is distributionUrl basename without extension
28+ distribution=`basename $distributionUrl .zip`
29+
30+ mvn=~/.m2/wrapper/dists/$distribution/*/bin/mvn
31+ echo "mvnw will call $mvn"
32+
33+ exec $mvn "$@"
Original file line number Diff line number Diff line change 99 " -Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR% " ^
1010 %LAUNCHER_CLASS% %*
1111if ERRORLEVEL 1 goto error
12+
13+ @ REM read distributionUrl from $MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties
14+ FOR /F " tokens=1,2 delims==" %%A IN (" %MAVEN_PROJECTBASEDIR% \.mvn\wrapper\maven-wrapper.properties" ) DO (
15+ IF " %%A " == " distributionUrl" SET DISTRIBUTION_URL = %%B
16+ )
17+
18+ for /F %i in (% DISTRIBUTION_URL%) do SET DISTRIBUTION=% ~ni
19+
20+ SET MVN = %USERPROFILE% \.m2\wrapper\dists\%DISTRIBUTION% /*/bin/mvn.cmd
21+
22+ %MVN% %*
23+
1224goto end
1325
1426:error
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ private void replaceProperties( Path targetFolder ) throws IOException
218218 try ( BufferedWriter out = Files .newBufferedWriter ( wrapperPropertiesFile ) )
219219 {
220220 out .append ( license );
221- out .append ( "distributionUrl=" + distributionUrl );
221+ out .append ( "distributionUrl=" + distributionUrl + " \n " );
222222 }
223223 }
224224
Original file line number Diff line number Diff line change 3131 * Maven starter, from a provided Maven home directory.
3232 *
3333 * @author Hans Dockter
34+ * @deprecated will be removed once launching Maven is not done here but in mvnw script by calling mvn
3435 */
3536public class BootstrapMainStarter
3637{
@@ -47,7 +48,8 @@ public void start( String[] args, Path mavenHome )
4748 System .setProperty ( "classworlds.conf" , mavenHome .resolve ( "bin/m2.conf" ).toAbsolutePath ().toString () );
4849
4950 Method mainMethod = mainClass .getMethod ( "main" , String [].class );
50- mainMethod .invoke ( null , new Object [] { args } );
51+ //mainMethod.invoke( null, new Object[] { args } );
52+ System .out .println ( "Now, mvnw script should call " + mavenHome .toAbsolutePath ().toString () + "/bin/mvn" );
5153 }
5254
5355 private Path findLauncherJar ( Path mavenHome ) throws RuntimeException , IOException
You can’t perform that action at this time.
0 commit comments