Skip to content

Commit 8bf5b0e

Browse files
committed
fix(wrapper): trim property keys when parsing maven-wrapper.properties
When an IDE or formatter adds spaces around '=' in maven-wrapper.properties (e.g., 'distributionUrl = ...'), the shell parser's IFS='=' split leaves trailing whitespace in the key, causing case pattern matches to fail with 'cannot read distributionUrl property'. Apply trim() to keys in all three property-parsing loops (mvnw: wrapperUrl + wrapperSha256Sum; only-mvnw: distributionUrl + distributionSha256Sum) to tolerate such formatting. Fixes #369
1 parent 65f601b commit 8bf5b0e

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

maven-wrapper-distribution/src/resources/mvnw

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

maven-wrapper-distribution/src/resources/only-mvnw

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ scriptName="$(basename "$0")"
110110

111111
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
112112
while IFS="=" read -r key value; do
113+
key=$(trim "${key-}")
113114
case "${key-}" in
114115
distributionUrl) distributionUrl=$(trim "${value-}") ;;
115116
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;

0 commit comments

Comments
 (0)