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

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

commit f386de2d45f20e644e952b913525cabc1bb96e80
Author: Benjamin Marwell <bmarw...@apache.org>
AuthorDate: Fri Feb 9 16:20:13 2024 +0100

    [MWRAPPER-86] trim repo url
---
 .../main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java
 
b/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java
index 76fdf78..9674b58 100644
--- 
a/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java
+++ 
b/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java
@@ -339,8 +339,11 @@ public class WrapperMojo extends AbstractMojo {
 
         // adapt to also support MVNW_REPOURL as supported by mvnw scripts 
from maven-wrapper
         String mvnwRepoUrl = System.getenv(MVNW_REPOURL);
-        if (mvnwRepoUrl != null && !mvnwRepoUrl.isEmpty()) {
-            repoUrl = mvnwRepoUrl;
+        if (mvnwRepoUrl != null && !mvnwRepoUrl.trim().isEmpty()) {
+            repoUrl = mvnwRepoUrl.trim();
+            if (repoUrl.endsWith("/")) {
+                repoUrl = repoUrl.substring(0, repoUrl.length() - 2);
+            }
             getLog().debug("Using repo URL from " + MVNW_REPOURL + " 
environment variable.");
         }
         // otherwise mirror from settings

Reply via email to