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/25 06:52:50 UTC

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

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



##########
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:
       to remove `*`, in Unix shell, I suppose we can derive directory name from with `basename $distribution -bin`
   I'm not too much worried in POSIX shell: equivalent implementation in Windows cmd is harder to me
   
   on running java twice, I suppose the script can check if the distribution is already installed to not run the installation `java -jar maven-wrapper.jar` if not really necessary
   




-- 
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