This is an automated email from the ASF dual-hosted git repository.
sjaranowski 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 bdf92ee [MWRAPPER-95] Update mvnw to handle \r in jvm.config (#86)
bdf92ee is described below
commit bdf92ee814016db8bdd91174439b3fe1a7e4e02d
Author: Ashley <[email protected]>
AuthorDate: Sat Feb 18 16:50:09 2023 +0000
[MWRAPPER-95] Update mvnw to handle \r in jvm.config (#86)
If Git checks out the jvm.config file with CRLF line endings,
a condition can arise in Git Bash where \r does not get
removed, resulting in -Xarg becoming '-Xarg\r' and breaking
builds on Windows. This is reproducible in environments
like GitHub Actions runners.
---
maven-wrapper-distribution/src/resources/mvnw | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/maven-wrapper-distribution/src/resources/mvnw
b/maven-wrapper-distribution/src/resources/mvnw
index 52233cb..c5abf3c 100755
--- a/maven-wrapper-distribution/src/resources/mvnw
+++ b/maven-wrapper-distribution/src/resources/mvnw
@@ -160,7 +160,12 @@ find_maven_basedir() {
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
- tr -s '\n' ' ' < "$1"
+ # Remove \r in case we run on Windows within Git Bash
+ # and check out the repository with auto CRLF management
+ # enabled. Otherwise, we may read lines that are delimited with
+ # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
+ # splitting rules.
+ tr -s '\r\n' ' ' < "$1"
fi
}