Skip to content

Commit 75dc2b3

Browse files
committed
Add -Dline.separator to Maven Wrapper
Since it is impossible to add `-Dline.separator=\n` in a system-independent way, I add it to the Maven Wrapper scripts.
1 parent 21cac75 commit 75dc2b3

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ target/
2424
.project
2525
.classpath
2626
.settings/
27+
# Maven Wrapper
28+
/.mvn/wrapper/maven-wrapper.jar

mvnw

+3
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,14 @@ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
298298
export MAVEN_CMD_LINE_ARGS
299299

300300
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
301+
LINE_SEPARATOR="
302+
"
301303

302304
# shellcheck disable=SC2086 # safe args
303305
exec "$JAVACMD" \
304306
$MAVEN_OPTS \
305307
$MAVEN_DEBUG_OPTS \
308+
"-Dline.separator=$LINE_SEPARATOR" \
306309
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
307310
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
308311
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

mvnw.cmd

+7
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,18 @@ IF NOT %WRAPPER_SHA_256_SUM%=="" (
174174
@REM Provide a "standardized" way to retrieve the CLI args that will
175175
@REM work with both Windows and non-Windows executions.
176176
set MAVEN_CMD_LINE_ARGS=%*
177+
@REM Do not remove the blank lines
178+
(set \n=^^^
179+
180+
^
181+
182+
)
177183

178184
%MAVEN_JAVA_EXE% ^
179185
%JVM_CONFIG_MAVEN_PROPS% ^
180186
%MAVEN_OPTS% ^
181187
%MAVEN_DEBUG_OPTS% ^
188+
-Dline.separator=%\n% ^
182189
-classpath %WRAPPER_JAR% ^
183190
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
184191
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*

0 commit comments

Comments
 (0)