From 75ba3d35107f2f8067b5be137aa56ae445b85215 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 16 Nov 2021 15:49:40 -0800 Subject: [PATCH 1/3] FAQ: add sbt bare settings --- _overviews/FAQ/index.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/_overviews/FAQ/index.md b/_overviews/FAQ/index.md index e74d5a9a4a..b675ff8ba4 100644 --- a/_overviews/FAQ/index.md +++ b/_overviews/FAQ/index.md @@ -277,3 +277,31 @@ give the compiler, then it's a compiler bug. Please report it on the [Scala 2 bug tracker](https://github.com/scala/bug/issues) or [Scala 3 bug tracker](https://github.com/lampepfl/dotty/issues), but check first if it's a duplicate of an existing ticket. + +### I set a setting in sbt but nothing happened. Why? + +There could be a lot of reasons. An extremely common one, that +almost everyone runs into sooner or later, is that you have a bare +setting in a multi-project build. + +For example, if you add this to your `build.sbt`: + + scalaVersion := "2.13.7" + +that's a "bare" setting, and you might expect it to apply build-wide. +But it doesn't. _It only applies to the root project._ + +Ways of changing a setting more widely include: + +* `ThisBuild` +* `Global` +* the common settings pattern, where you put shared settings + in a `val`, typically named `commonSettings`, and then + `.settings(commonSettings)` in every project you want to + apply to them to. +* in interactive usage only, `set every` + +Here's some further reading: + +* [documentation on multi-project builds](https://www.scala-sbt.org/1.x/docs/Multi-Project.html#ThisBuild) +* [issue about bare settings](https://github.com/sbt/sbt/issues/6217) From 0a6cfed9923b53c0f8cddacbfed2259925b77a57 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 16 Nov 2021 16:04:16 -0800 Subject: [PATCH 2/3] tweak in response to review feedback --- _overviews/FAQ/index.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_overviews/FAQ/index.md b/_overviews/FAQ/index.md index b675ff8ba4..b0b7b362d9 100644 --- a/_overviews/FAQ/index.md +++ b/_overviews/FAQ/index.md @@ -291,9 +291,12 @@ For example, if you add this to your `build.sbt`: that's a "bare" setting, and you might expect it to apply build-wide. But it doesn't. _It only applies to the root project._ -Ways of changing a setting more widely include: +In many cases one should simply write instead: + + ThisBuild / scalaVersion := "2.13.7" + +Other possibilities include: -* `ThisBuild` * `Global` * the common settings pattern, where you put shared settings in a `val`, typically named `commonSettings`, and then From 322f0ad09c41fd6a92fed9cee6b235c4dfb7cbac Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 17 Nov 2021 07:41:42 -0800 Subject: [PATCH 3/3] tweak in reponse to review feedback --- _overviews/FAQ/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_overviews/FAQ/index.md b/_overviews/FAQ/index.md index b0b7b362d9..42f5406a90 100644 --- a/_overviews/FAQ/index.md +++ b/_overviews/FAQ/index.md @@ -297,7 +297,6 @@ In many cases one should simply write instead: Other possibilities include: -* `Global` * the common settings pattern, where you put shared settings in a `val`, typically named `commonSettings`, and then `.settings(commonSettings)` in every project you want to