Consider scoping the scala version only in ThisBuild or in Global
See original GitHub issueproblem
scalaVersion
is scoped for every build. This often causes problems when people want to set their scala versions globally, because they are overriden by the sbt defaults.
expectation
When people override the scala version in Global
or in ThisBuild
, sbt should pick up the scala versions from there since sbt does not scope sbt version to every project.
notes
I am not sure this is technically possible. But I think it’s an interesting effort that will make sbt more intuitive. @olafurpg has complained several times that this is the current behaviour.
sbt version: 0.13.x and 1.x.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
What is the difference between ThisBuild and Global scopes?
Global is a scope that sets Zero to all axes: Zero / Zero / Zero . ... Zero whereas ThisBuild sets only the...
Read more >sbt Reference Manual — Scopes
Scopes. This page describes scopes. It assumes you've read and understood the previous pages, build definition and task graph.
Read more >Unification of sbt shell notation and build.sbt DSL - Tooling
I've long thought that sbt having two notations for setting keys, one for sbt shell and another for build.sbt made the tool harder...
Read more >Making sense of SBT - Beyond the lines
The difference between the build.sbt and a scala file is that build.sbt ... tries the special scope ThisBuild , then the Global scope....
Read more >The Scala Build Tool - It is all about Settings and Tasks - Binx
There's a special scope component ThisBuild (written as '{.}' in shell) for the subprojects axis only. Test extends Runtime, and Runtime extends ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Due to the mechanics of
derive
and what we do with it in Defaults (namely definescalaVersion
,scalaBinaryVersion
and, specifically,crossScalaVersions
) this is a regression in sbt 0.13.16-M1.steps
Given this build:
problem
In sbt 0.13.16-M1 or sbt 0.13.16-RC1:
expectation
How it used to work, such as in sbt 0.13.15:
notes
The commit that folded sbt-cross-building into sbt introduced the project-scoped
scalaVersion
setting: https://github.com/sbt/sbt/commit/ff017eb475fbf18b8066125596bcd1a8cd8fb3ff#diff-6373e7f7122325e753b75fe1cc76ff5fR247This is a feature interaction between sbt version cross building and Scala version cross building.
Normally I try not to mess with existing globally-scoped keys, and I was aware that people often define
scalaVersion in ThisBuild
, so I did define a forwarder:I think I just need to do something similar with
crossScalaVersions
.Note that recently merged https://github.com/sbt/sbt/pull/3356 re-injects
scalaVersion
at project-level on^^
. This might allow us to remove project-levelscalaVersion
initialization in Defaults, but I considering^ compile
etccrossScalaVersions
forwarding still might be needed.