[2.x] fix: handle --version in sbt 2.x project dirs (sbt#8717)#8735
Merged
eed3si9n merged 3 commits intosbt:developfrom Feb 13, 2026
Merged
[2.x] fix: handle --version in sbt 2.x project dirs (sbt#8717)#8735eed3si9n merged 3 commits intosbt:developfrom
eed3si9n merged 3 commits intosbt:developfrom
Conversation
**Problem** `sbt --version` in sbt 2.x project directories was delegated to the native client, which could try to start/connect to a server instead of printing version info. **Solution** Skip native-client delegation when `--version` is requested, and add runner-script tests for sbt 1.x and 2.x project variants.
**Problem** Runner/client integration tests had CI-only instability from duplicated assertions and a destructive three-command test path. **Solution** Refactored version assertions in RunnerScriptTest and replaced the destructive `clean` sequence in ClientTest with a stable non-destructive three-command success path.
**Problem** Windows batch parsing for `sbtVersion` used a fragile token extraction that could capture non-version tokens from noisy output. **Solution** Updated `:set_sbt_version` to select and validate version-shaped tokens and fallback to `build_props_sbt_version` when parsing is noisy.
eed3si9n
pushed a commit
to eed3si9n/sbt
that referenced
this pull request
Feb 14, 2026
) **Problem** `sbt --version` in sbt 2.x project directories was delegated to the native client, which could try to start/connect to a server instead of printing version info. **Solution** Skip native-client delegation when `--version` is requested, and add runner-script tests for sbt 1.x and 2.x project variants.
eed3si9n
added a commit
that referenced
this pull request
Feb 14, 2026
…8739) **Problem** `sbt --version` in sbt 2.x project directories was delegated to the native client, which could try to start/connect to a server instead of printing version info. **Solution** Skip native-client delegation when `--version` is requested, and add runner-script tests for sbt 1.x and 2.x project variants. Co-authored-by: Pluto <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 #8717
Summary
In this PR,
sbt --versionbehavior in sbt 2.x project directoriesReproduction
1. Make a sbt 2.x project
2. Manual check
Problem
In sbt 2.x project directories,
--versionwas being routed to the native client (sbtn) instead of being handled directly by the runner script.Solution
Handle
--versionbefore native-client delegation.When
--versionis present, skip sbtn and run the runner’s direct version-print path.Test
Manual check
Related test hardening for CI
RunnerScriptTestassertions robust to valid output variants while keeping regression guard.:set_sbt_versionparsing by validating version-shaped tokens with fallback.cleaninClientTestthree-command success test with a non-destructive sequence.