[2.x] fix: Handle JVM parameters with spaces in dot files#8730
Merged
eed3si9n merged 3 commits intosbt:developfrom Feb 14, 2026
Merged
[2.x] fix: Handle JVM parameters with spaces in dot files#8730eed3si9n merged 3 commits intosbt:developfrom
eed3si9n merged 3 commits intosbt:developfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7333
Problem
The sbt launcher script used naive word splitting when parsing
.sbtoptsand.jvmopts, so arguments with spaces were split incorrectly. For example,-J--add-modules jdk.incubator.concurrentin.sbtoptsand-Dtest.key="value with spaces"in.jvmoptswere not passed to the JVM as intended.Solution
Parsing was updated to be quote-aware. A new
parseLineIntoWords()helper splits lines while respecting single and double quotes.loadConfigFileIntoArray()loads config files into bash arrays: for-Jlines it splits the remainder and prepends-Jto each token (e.g.-J--add-modules jdk.incubator.concurrent→-J--add-modulesand-Jjdk.incubator.concurrent); for other lines it uses quote-aware splitting..sbtoptsnow usesloadConfigFileIntoArrayinstead ofloadConfigFile;.jvmoptsusesloadConfigFileIntoArrayand merges the result intojava_argsinstead of appending viaJAVA_OPTSstring concatenation.Testing
Two integration tests were added in
RunnerScriptTest.scala: one for-J--add-modules jdk.incubator.concurrentin.sbtopts, and one for-Dtest.7333="value with spaces"in.jvmopts, both verifying that the full values are passed correctly to the JVM.