An example sbt build.sbt file for a Scala 3 (3.0.0-M3) project (including scalacOptions)

As a brief note to self, this is an example sbt build.sbt file I just used for a Scala 3 (3.0.0-M3) project, including several scalacOptions:

name := "ScalaSlowSocketServer"
version := "0.1"
scalaVersion := "3.0.0-M3"   // now "3.0.0-RC1"
useScala3doc := true

fork in run := true

scalacOptions ++= Seq(

Also, in addition to looking at scalac -h output to see what scalac options are available, you can also look at the source code in the Scala 3 ScalaSettings.scala class.

One more example of a Scala 3 build.sbt file

While I’m in the neighborhood, here’s another example of a Scala 3 build.sbt file, with quite a few more configuration options than the previous example:

val scala3Version = "3.0.0-M3"

lazy val root = project
      name := "numbers-dates",
      version := "0.1.0",
      scalaVersion := scala3Version,
      libraryDependencies += "io.monix" %% "minitest" % "2.9.2" % "test",
      testFrameworks += new TestFramework("minitest.runner.Framework")

scalacOptions ++= Seq(
   "-deprecation",         // emit warning and location for usages of deprecated APIs
   "-explain",             // explain errors in more detail
   "-explain-types",       // explain type errors in more detail
   "-feature",             // emit warning and location for usages of features that should be imported explicitly
   "-indent",              // allow significant indentation.
   "-new-syntax",          // require `then` and `do` in control expressions.
   "-print-lines",         // show source code line numbers.
   "-unchecked",           // enable additional warnings where generated code depends on assumptions
   "-Ykind-projector",     // allow `*` as wildcard to be compatible with kind projector
   "-Xfatal-warnings",     // fail the compilation if there are any warnings
   "-Xmigration",          // warn about constructs whose behavior may have changed since version