[2.x] fix: handle --script-version sbt 2.x project dirs#8715
Merged
eed3si9n merged 2 commits intosbt:developfrom Feb 8, 2026
Merged
[2.x] fix: handle --script-version sbt 2.x project dirs#8715eed3si9n merged 2 commits intosbt:developfrom
eed3si9n merged 2 commits intosbt:developfrom
Conversation
…x project dirs When in an sbt 2.x project directory, the script used to delegate to sbtn before checking --script-version, so 'sbt --script-version' ran sbtn and failed. Now we print the script version and exit before the native client branch.
eed3si9n
requested changes
Feb 8, 2026
…two test variants - sbt: remove duplicate --script-version handling from run() (keep only early check) - ShellScriptUtil: add citestVariant parameter to testOutput (default citest) - Add launcher-package/citest2 with sbt.version=2.0.0-RC8 - RunnerScriptTest: run --script-version test on citest (1.x) and citest2 (2.x)
eed3si9n
pushed a commit
to eed3si9n/sbt
that referenced
this pull request
Feb 14, 2026
When in an sbt 2.x project directory, the script used to delegate to sbtn before checking --script-version, so 'sbt --script-version' ran sbtn and failed. Now we print the script version and exit before the native client branch.
eed3si9n
added a commit
that referenced
this pull request
Feb 14, 2026
When in an sbt 2.x project directory, the script used to delegate to sbtn before checking --script-version, so 'sbt --script-version' ran sbtn and failed. Now we print the script version and exit before the native client branch. Co-authored-by: PandaMan <[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.
What
Fixes #8711:
sbt --script-versionnow works when run from an sbt 2.x project directory.Problem
From a project with
project/build.propertiesset to sbt 2.x (e.g.sbt.version=2.0.0-RC8), the script defaults to the native client (sbtn). The--script-versionflag was only handled insiderun()(the JVM launcher path), so when the script took the native client path it never checked--script-versionand instead ran sbtn with that flag. sbtn doesn’t implement it, so the user saw "failed to connect to server" instead of the script version.Solution
Handle
--script-versionright afterprocess_argsand before theisRunNativeClientbranch. Ifprint_sbt_script_versionis set, print$init_sbt_versionand exit, so we never delegate to sbtn for this case.Testing
./sbt --script-version→ prints_to_be_replacedsbt --script-version→ prints_to_be_replaced(no sbtn run)