Skip to content

[2.x] fix: Propagate SBT_OPTS to BSP config#8531

Merged
eed3si9n merged 1 commit intosbt:developfrom
MkDev11:fix/bsp-config-sbt-opts-7469
Jan 14, 2026
Merged

[2.x] fix: Propagate SBT_OPTS to BSP config#8531
eed3si9n merged 1 commit intosbt:developfrom
MkDev11:fix/bsp-config-sbt-opts-7469

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 14, 2026

Propagate SBT_OPTS environment variable to BSP connection file

Description

When using sbt with IDEs through BSP (Build Server Protocol), the JVM options set in SBT_OPTS weren't being passed to the BSP server. This meant things like custom memory settings or system properties would work in the terminal but not when using BSP.

This PR fixes that by reading SBT_OPTS when generating the BSP connection file and including the relevant JVM options (-D, -X, -J prefixed args) in the server startup command.

Changes

  • Parse SBT_OPTS environment variable in BuildServerConnection.writeConnectionFile
  • Add parsed JVM options to the BSP server argv
  • Strip -J prefix from options (same behavior as the sbt launcher)

Testing

  • Added unit tests for the parseSbtOpts method covering various option formats

Fixes #7469


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

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 14, 2026

@eed3si9n can you please have a look at the PR and let me know the feedback?

@eed3si9n
Copy link
Copy Markdown
Member

Not sure why AppVeyor is showing up here.

Fixes sbt#7469

When running 'sbt bspConfig', the generated .bsp/sbt.json now includes
JVM options from the SBT_OPTS environment variable. This ensures that
options like -Dsbt.boot.directory are propagated to the BSP server.

The parseSbtOpts method extracts -D, -X, and -J prefixed options from
SBT_OPTS and includes them in the BSP connection argv.
@MkDev11 MkDev11 force-pushed the fix/bsp-config-sbt-opts-7469 branch from b1cce73 to 6c984fa Compare January 14, 2026 16:52
@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 14, 2026

Not sure why AppVeyor is showing up here.

Sorry for the mistake, just fixed it

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eed3si9n eed3si9n changed the title fix: Propagate SBT_OPTS to BSP config [2.x] fix: Propagate SBT_OPTS to BSP config Jan 14, 2026
@eed3si9n eed3si9n merged commit 1ed08f0 into sbt:develop Jan 14, 2026
14 checks passed
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 doesn't propagate SBT_OPTS to the generated bsp config

2 participants