Skip to content

[2.x] fix: trim whitespace from sbt.version in build.properties#8524

Merged
eed3si9n merged 1 commit intosbt:developfrom
0xsatoshi99:fix-build-properties-trim
Jan 14, 2026
Merged

[2.x] fix: trim whitespace from sbt.version in build.properties#8524
eed3si9n merged 1 commit intosbt:developfrom
0xsatoshi99:fix-build-properties-trim

Conversation

@0xsatoshi99
Copy link
Copy Markdown
Contributor

When sbt.version in build.properties has trailing whitespace, sbt incorrectly reports a version mismatch even after reboot.

Problem

As reported in #8103, when project/build.properties contains:

sbt.version=2.0.0-M3 

(note the trailing space)

SBT shows the warning:

sbt version mismatch, using: 2.0.0-M3, in build.properties: "2.0.0-M3 ", use 'reboot' to use the new value.

This warning persists even after reboot and reload commands.

Solution

This PR trims whitespace from the sbt.version property value in all places where it's read from build.properties:

  • Main.scala - fixes the version mismatch warning (the main issue)
  • MainLoop.scala - fixes clean command version detection
  • ScriptedTests.scala - fixes test compatibility check

The fix adds .map(_.trim) after reading the property, ensuring whitespace is removed before any comparison.

Testing

The fix can be verified by:

  1. Creating a project with sbt.version=2.0.0-M3 (with trailing space) in project/build.properties
  2. Starting sbt
  3. Confirming the version mismatch warning no longer appears

Fixes #8103


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

@eed3si9n
Copy link
Copy Markdown
Member

Looks like this PR has a few extra commits. Do you mind dropping those, via git rebase -i.

When sbt.version in build.properties has trailing whitespace,
sbt incorrectly reports a version mismatch even after reboot.

This fix trims the property value in all places where sbt.version
is read from build.properties:
- Main.scala (version mismatch warning)
- MainLoop.scala (clean command version detection)
- ScriptedTests.scala (test compatibility check)

Fixes sbt#8103
@0xsatoshi99 0xsatoshi99 force-pushed the fix-build-properties-trim branch from 4eebe6b to c622b63 Compare January 14, 2026 00:53
@0xsatoshi99
Copy link
Copy Markdown
Contributor Author

Fixed! Rebased onto latest develop and now the PR contains only 1 commit. The extra commits were from an outdated base branch.

@eed3si9n eed3si9n changed the title fix: trim whitespace from sbt.version in build.properties [2.x] fix: trim whitespace from sbt.version in build.properties Jan 14, 2026
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 merged commit 43e0428 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 version mismatch" is sensitive to trailing whitespaces

2 participants