Skip to content

[2.x] fix: Fix sbt new argument parsing on Windows#8509

Merged
eed3si9n merged 4 commits intosbt:developfrom
MkDev11:fix/windows-sbt-new-args-7507
Jan 13, 2026
Merged

[2.x] fix: Fix sbt new argument parsing on Windows#8509
eed3si9n merged 4 commits intosbt:developfrom
MkDev11:fix/windows-sbt-new-args-7507

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 13, 2026

Fix sbt new argument parsing on Windows

This is a long-standing Windows issue where arguments containing = get split by the command line parser.

When running something like:

sbt new foundweekends/giter8.g8 --name=example.g8

Windows splits --name=example.g8 into two separate arguments (--name and example.g8), causing sbt to fail with "Unknown option" errors.

The batch script already handles this for -D and -XX JVM arguments by detecting when an argument was split and recombining it. This PR extends that same approach to -- style arguments used by giter8 templates.

Related to #2695.

Fixes #7507


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147

@eed3si9n
Copy link
Copy Markdown
Member

CI hasn't finished in 1h, so maybe there's an infinite loop now?

Only recombine split -- arguments after new/init command.

Fixes sbt#7507
@MkDev11 MkDev11 force-pushed the fix/windows-sbt-new-args-7507 branch from 614cb20 to 4f8decb Compare January 13, 2026 08:37
@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 13, 2026

CI hasn't finished in 1h, so maybe there's an infinite loop now?

Fixed by adding if defined sbt_new condition so the -- argument recombination only applies after new/init command. The previous version was too broad and could cause issues with other -- flags

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 13, 2026

the failure is not an actual error. this is a known quirk of sbt's output formatting

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 13, 2026

All good!

@eed3si9n eed3si9n changed the title Fix sbt new argument parsing on Windows [2.x] fix: Fix sbt new argument parsing on Windows Jan 13, 2026
@eed3si9n eed3si9n merged commit 28f7957 into sbt:develop Jan 13, 2026
14 checks passed
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Jan 17, 2026
Only recombine split -- arguments after new/init command.

Fixes sbt#7507
@eed3si9n eed3si9n added this to the 1.12.1 milestone Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbt new fails to parse arguments correctly on Windows

2 participants