You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/05/21 13:04:02 UTC

(maven-wrapper) branch MWRAPPER-140 created (now 3de0708)

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

cstamas pushed a change to branch MWRAPPER-140
in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git


      at 3de0708  [MWRAPPER-140] only-script type does not honor MAVEN_USER_HOME

This branch includes the following new commits:

     new 3de0708  [MWRAPPER-140] only-script type does not honor MAVEN_USER_HOME

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-wrapper) 01/01: [MWRAPPER-140] only-script type does not honor MAVEN_USER_HOME

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch MWRAPPER-140
in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git

commit 3de0708945e79a9658298e81c748437740592ba5
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue May 21 15:03:31 2024 +0200

    [MWRAPPER-140] only-script type does not honor MAVEN_USER_HOME
    
    User provided patch
    
    ---
    
    https://issues.apache.org/jira/browse/MWRAPPER-140
---
 maven-wrapper-distribution/src/resources/only-mvnw     | 3 ++-
 maven-wrapper-distribution/src/resources/only-mvnw.cmd | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/maven-wrapper-distribution/src/resources/only-mvnw b/maven-wrapper-distribution/src/resources/only-mvnw
index 9ae209d..02b2e72 100755
--- a/maven-wrapper-distribution/src/resources/only-mvnw
+++ b/maven-wrapper-distribution/src/resources/only-mvnw
@@ -139,7 +139,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"