Skip to content

Build sbt 2 plugin with Scala 3.9 LTS and sbt 2.1 - #517

Open
mkurz wants to merge 1 commit into
rtimush:masterfrom
mkurz:sbt2cross-update
Open

mkurz wants to merge 1 commit into
rtimush:masterfrom
mkurz:sbt2cross-update

Conversation

@mkurz

@mkurz mkurz commented Nov 17, 2026

Copy link
Copy Markdown

Summary

  • Build the sbt 2 plugin lane with Scala 3.9.0 LTS and declare sbt 2.1.0 as its minimum.
  • Make compiler and plugin sbt compatibility versions explicit; retain the sbt 1 lane and unrelated library baselines.
  • Align relevant CI/scripted settings, preserve Java 17 publishing, and check Dependabot. No Scala Steward pins are added.

Local verification uses a separate full checkout because the existing JGit dependency does not recognize linked worktrees. Original checkout is untouched. The Scala 3 compatibility shim uses public sbt.librarymanagement.CredentialUtils instead of the removed internal IvyCredentials helper; the Scala 2 credential implementation is unchanged.

The Scala 3.9-built plugin requires sbt 2.1 or newer; the sbt 1 artifact remains separately cross-built.

Verification

  • sbt -batch "set every scriptedParallelInstances := 1" "scalafmtSbt" "scalafmtAll": passed on Java 17.
  • sbt -batch "set every scriptedParallelInstances := 1" "project sbt-updates-2_x" "set Compile / scalacOptions := (Compile / scalacOptions).value.filterNot(o => o.startsWith(\"-Wconf:\") || Set(\"-Werror\", \"-Xfatal-warnings\", \"-Wwarning\").contains(o)) ++ Seq(\"-rewrite\", \"-source\", \"3.8-migration\")" "clean" "compile": passed on Java 17.
  • sbt -batch "set every scriptedParallelInstances := 1" "sbt-updates-1_x/compile" "sbt-updates-2_x/compile" "sbt-updates-1_x/test" "sbt-updates-2_x/test" "sbt-updates-1_latest/scripted" "sbt-updates-2_1_0/scripted": passed on Java 17.

References

@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@rtimush

rtimush commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Hi. What is the motivation for this change? With sbt-updates installed globally, bumping minimal supported sbt version is a big deal.

@mkurz

mkurz commented Nov 19, 2026

Copy link
Copy Markdown
Author

The motivation is to move the sbt 2 plugin to Scala 3.9 LTS as its long-term compiler baseline, with sbt 2.1 as the corresponding minimum. This follows eed3si9n’s reasoning about a stable foundation after the sbt 2.1 release, rather than addressing a dependency-update feature that requires sbt 2.1.

I agree that global installation makes the compatibility impact particularly important: updating the global plugin would stop it working with sbt 2.0 builds. That is a real trade-off, not something the LTS rationale eliminates. The sbt 1 plugin remains separately cross-built.

@rtimush

rtimush commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Closing, as there seems to be no compelling reasons to use scala 3.9 dropping sbt 2.0 compatibility.
Please feel free to re-open if you have an actual reason (with an explanation from a human, not from AI, please).

@rtimush rtimush closed this Nov 19, 2026
@mkurz

mkurz commented Nov 19, 2026

Copy link
Copy Markdown
Author

human: The idea is that the sbt plugin ecosystem starts targeting sbt 2.1.0 / Scala 3.9.0 as baseline from now on. Reason is because Scala 3.9 is a LTS and will receives fixes for many years.
For example a company builds an application and uses sbt 2.0 with a couple of sbt plugins that all work fine currently. Now, one of those plugins now need to bump its sbt version because it has some problem that is fixed only by a newer Scala release (sbt 2.0 targets 3.8 which is not maintained anymore) - that means when application(s) upgrade(s) the plugins, the whole application will fail to compile because of scala incompatibilies. So the application now needs to upgrade to sbt 2.1 or 2.2. or whatever the plugins bumpted to as well (determined by the scala version the sbt plugins targets then).
That means the application maybe even need to make more changes since the newer scala version requires changes to the sbt build of the application (I have seen this with 2.0/scala 3.8 to 2.1/scala 3.9 already)

But if we all would agree to already use sbt 2.1.0 and Scala 3.9 as the baseline for sbt plugins now, that would mean we would get scala fixes also for sbt plugins for many years to come and without requring applications bumping from 2.0 to 2.1 in the future avoiding any burden on application developers.

Why do I think that make sense or why do I think that should be at least considered by the sbt ecosystem and why I came up with that whole initiative: When we do that now, coordinated, we can avoid mess and wild west in the future.

For enterprises using Scala and sbt plugins being able to rely in stable plugins, stable code is very important.

I get contacted by companies asking "why does this break", "why is sbt complaining", every now and then. companies that run 1000+ microservcies in scala or copanpies that run hundrets of on-prem scala applications at their customer locations. Not every developer of that companies is knee deep into sbt and scala to fully understand the problems, and then complain about "why is sbt and scala breaking again just because I upgraded a sbt plugin"?

For me my guts feelings just tells me its much better if the majority of the scala plugins already target 2.1.0 / Scala 3.9.0 now already for the upcoming years to avoid mess later on, where we have to ask maintainers (and hope they haven't gone on holiday) to please up- or downgrade a plugin's sbt/scala target again because its last release that contained an important security fix (sbt2ssh2shell4rootaccess) causes incompatibilities with the rest of the sbt ecosystem.

Also, libraries and plugins targeting 3.9 will not be asked by scala steward to upgrade to scala.next as scala steward will only suggest to bump to the next scala lts in a few years.
But if a sbt plugins is on 3.8.x, scala steward will come and ask you to bump to 3.10 and then a maintainer in a hurry will just merged that one and then will happily release a new versin and oops, breaks many applications again. because application is on sbt 2.0 and suddenly Scala 3.10 is not compatible with 3.9 used by sbt 2.0. (you can replace 3.10 with 3.12 and 2.0 with 2.3 in future).
and then 25 man company from switzerland will sign up on github to add comment "why is my scala breaking again"?

@mkurz

mkurz commented Nov 19, 2026

Copy link
Copy Markdown
Author

And also sbt 2.1.0 release notes (https://github.com/sbt/sbt/releases/tag/v2.1.0) say:

While publishing plugins using sbt 2.1.0 would mean that it would no longer be compatible with sbt 2.0.x, given that Scala 3.9 is an LTS that will be supported for the next 3 years, we should use it as a new baseline. Here's how to set the minimal sbt version for your plugin:...

@rtimush rtimush reopened this Nov 21, 2026
@rtimush

rtimush commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Hi @mkurz, thank you for the write-up. I re-opened the PR as you have a point here. Although, I'm still not sure if this trade-off is worth it, I need to think a bit about it. For a regular plugin that is typically added as a part of the build it would be almost a no-brainer. For a plugin, that in my opinion should be installed globally, it is a bit more complicated.

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.

2 participants