[ https://issues.apache.org/jira/browse/MWRAPPER-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17847285#comment-17847285 ]
Adrian Shum commented on MWRAPPER-140: -------------------------------------- {{Following is a quick fix I done myself but I have just found that I am not allowed to push changes and create pull requests.}} I applied the same change of mvnw locally and seems working fine, but Windows mvwn.cmd I have no way to test. {{diff --git a/maven-wrapper-distribution/src/resources/only-mvnw b/maven-wrapper-distribution/src/resources/only-mvnw}} {{index b04e16b..dc12d6a 100755}} {{--- a/maven-wrapper-distribution/src/resources/only-mvnw}} {{+++ b/maven-wrapper-distribution/src/resources/only-mvnw}} {{@@ -131,7 +131,8 @@ esac}} {{ distributionUrlName="${distributionUrl##*/}"}} {{ distributionUrlNameMain="${distributionUrlName%.*}"}} {{ distributionUrlNameMain="${distributionUrlNameMain%-bin}"}} {{-MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"}} {{+MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"}} {{+MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"}} {{ }} {{ exec_maven() {}} {{ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :}} {{diff --git a/maven-wrapper-distribution/src/resources/only-mvnw.cmd b/maven-wrapper-distribution/src/resources/only-mvnw.cmd}} {{index da5a302..d3e39f4 100644}} {{--- a/maven-wrapper-distribution/src/resources/only-mvnw.cmd}} {{+++ b/maven-wrapper-distribution/src/resources/only-mvnw.cmd}} {{@@ -79,6 +79,9 @@ if ($env:MVNW_REPOURL) {}} {{ $distributionUrlName = $distributionUrl -replace '^.*/',''}} {{ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''}} {{ $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"}} {{+if ($env:MAVEN_USER_HOME) {}} {{+ $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"}} {{+}}} {{ $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object \{$_.ToString("x2")}) -join ''}} {{ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"}} {{ }} > only-script Type does not honor MAVEN_USER_HOME > ----------------------------------------------- > > Key: MWRAPPER-140 > URL: https://issues.apache.org/jira/browse/MWRAPPER-140 > Project: Maven Wrapper > Issue Type: Bug > Components: Maven Wrapper Scripts > Affects Versions: 3.3.1 > Reporter: Adrian Shum > Priority: Major > > As per described in [https://maven.apache.org/wrapper/index.html] we could > set MAVEN_USER_HOME to define the location that Maven distro be downloaded to. > For type=bin, it seems working as expected. However for type=script-only, it > is trying to create director under ~/.m2 even I have MAVEN_USER_HOME set. > -- This message was sent by Atlassian Jira (v8.20.10#820010)