You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by GitBox <gi...@apache.org> on 2021/11/22 15:47:12 UTC

[GitHub] [maven-wrapper-plugin] gzm55 commented on a change in pull request #5: [MWRAPPER-16] PoC call mvn(.cmd) script from mvnw(.cmd)

gzm55 commented on a change in pull request #5:
URL: https://github.com/apache/maven-wrapper-plugin/pull/5#discussion_r753891730



##########
File path: maven-wrapper-distribution/src/assembly/maven/run
##########
@@ -17,3 +17,17 @@ exec "$JAVACMD" \
   "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
   "-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR" \
   $LAUNCHER_CLASS "$@"
+
+# read distributionUrl from $MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties
+while IFS="=" read key value; do
+  case "$key" in (distributionUrl) distributionUrl="$value"; break ;;
+  esac
+done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+
+# local distribution dir is distributionUrl basename without extension
+distribution=`basename $distributionUrl .zip`
+
+mvn=~/.m2/wrapper/dists/$distribution/*/bin/mvn

Review comment:
       here the glob wildcard `*` will expand to multiple files or select a wrong version or not expand at all in some posix shell. To invoke the main entrance script, u has to print the full path of the distribution or at least the hash of url.
   
   The cons of this method is that `java` would be run twice. While the original way is the java way of exec invoking.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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