Skip to content

Commit 7863521

Browse files
committed
[gh-11363] Strip outer quotes from jvm.config arguments
Quotes in jvm.config are for grouping/escaping, but shouldn't be passed to the JVM. Strip them before re-quoting for batch script.
1 parent 0aca2e4 commit 7863521

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apache-maven/src/assembly/maven/bin/JvmConfigParser.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ public static void main(String[] args) {
6969
line = line.replace("${MAVEN_PROJECTBASEDIR}", mavenProjectBasedir);
7070
line = line.replace("$MAVEN_PROJECTBASEDIR", mavenProjectBasedir);
7171

72-
// Quote the argument to protect special characters
73-
// Escape any existing quotes by doubling them
72+
// Strip outer quotes if present (they're just for grouping in jvm.config)
73+
if (line.startsWith("\"") && line.endsWith("\"") && line.length() > 1) {
74+
line = line.substring(1, line.length() - 1);
75+
}
76+
77+
// Quote the argument to protect special characters for batch script
78+
// Escape any quotes by doubling them (batch script convention)
7479
line = line.replace("\"", "\"\"");
7580

7681
// Append quoted argument with space separator

0 commit comments

Comments
 (0)