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:00:02 UTC
(maven-wrapper) branch master updated: [MWRAPPER-139] Remove trailing whitespace from fields in maven-wrapper.properties (#139)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
The following commit(s) were added to refs/heads/master by this push:
new 1149c75 [MWRAPPER-139] Remove trailing whitespace from fields in maven-wrapper.properties (#139)
1149c75 is described below
commit 1149c7562bb694374b2405792ba37e8d75c8aeed
Author: Ashley <73...@users.noreply.github.com>
AuthorDate: Tue May 21 13:59:57 2024 +0100
[MWRAPPER-139] Remove trailing whitespace from fields in maven-wrapper.properties (#139)
This prevents issues due to confusion between CRLF and LF when
running in more exotic locations such as MINGW on Windows but
using ./mvnw rather than ./mvnw.cmd. A prime example of where
this is an issue would be on windows-latest GitHub Actions
runners.
Fixes MWRAPPER-139, MWRAPPER-137.
---
https://issues.apache.org/jira/browse/MWRAPPER-139
https://issues.apache.org/jira/browse/MWRAPPER-137
https://issues.apache.org/jira/browse/MWRAPPER-136
---
maven-wrapper-distribution/src/resources/only-mvnw | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/maven-wrapper-distribution/src/resources/only-mvnw b/maven-wrapper-distribution/src/resources/only-mvnw
index b04e16b..9ae209d 100755
--- a/maven-wrapper-distribution/src/resources/only-mvnw
+++ b/maven-wrapper-distribution/src/resources/only-mvnw
@@ -97,11 +97,19 @@ die() {
exit 1
}
+trim() {
+ # MWRAPPER-139:
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
+ # Needed for removing poorly interpreted newline sequences when running in more
+ # exotic environments such as mingw bash on Windows.
+ printf "%s" "${1}" | tr -d '[:space:]'
+}
+
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
while IFS="=" read -r key value; do
case "${key-}" in
- distributionUrl) distributionUrl="${value-}" ;;
- distributionSha256Sum) distributionSha256Sum="${value-}" ;;
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
esac
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"