Skip to main content
1 of 2
Mario Galic
  • 48.7k
  • 6
  • 64
  • 114

The key is to understand the difference between sbt proper build and sbt meta build projects. Conceptually they can be viewed as two different Scala projects with their own versions of Scala which might differ. For example, consider the following experiement:

Create a project from template:

➜  stackoverflow sbt new scala/scala-seed.g8
[info] welcome to sbt 1.4.7 (AdoptOpenJDK Java 1.8.0_275)
[info] loading settings for project global-plugins from idea.sbt,plugins.sbt ...
[info] loading global plugins from /Users/mario_galic/.sbt/1.0/plugins
[info] set current project to stackoverflow (in build file:/Users/mario_galic/code/stackoverflow/)
[info] set current project to stackoverflow (in build file:/Users/mario_galic/code/stackoverflow/)

A minimal Scala project.

name [Scala Seed Project]: proper-build-vs-meta-build-scala-version

Template applied in /Users/mario_galic/code/stackoverflow/./proper-build-vs-meta-build-scala-version

Now create a build.sbt file for the meta-build

➜  stackoverflow cd proper-build-vs-meta-build-scala-version
➜  proper-build-vs-meta-build-scala-version echo 'name := "meta-build-project"' > project/build.sbt

Now check the name and Scala version of the proper build

➜  proper-build-vs-meta-build-scala-version sbt
...
sbt:proper-build-vs-meta-build-scala-version> show name
[info] proper-build-vs-meta-build-scala-version
sbt:proper-build-vs-meta-build-scala-version> show scalaVersion
[info] 2.13.4

Now compare the the name and scala version of the meta build

sbt:proper-build-vs-meta-build-scala-version> reload plugins
...
sbt:meta-build-project> show name
[info] meta-build-project
sbt:meta-build-project> show scalaVersion
[info] 2.12.12

Notice how meta-build is a separate project with its own scala version. The purpose of this project is to build your proper project. We say sbt is recursive.

Therefore migrating the proper project to Scala 2.13, does not affect the Scala version of the sbt plugins which are part of the meta-build.

Mario Galic
  • 48.7k
  • 6
  • 64
  • 114