@@ -47,7 +47,7 @@ definition uses Scala only for tests:
4747``` scala
4848autoScalaLibrary := false
4949
50- libraryDependencies += " org.scala-lang" % " scala-library" % scalaVersion.value % " test "
50+ libraryDependencies += " org.scala-lang" % " scala-library" % scalaVersion.value % Test
5151```
5252
5353#### Configuring additional Scala dependencies
@@ -80,29 +80,31 @@ This will also disable the automatic dependency on `scala-library`. If
8080you do not need the Scala compiler for anything (compiling, the REPL,
8181scaladoc, etc...), you can stop here. sbt does not need an instance of
8282Scala for your project in that case. Otherwise, sbt will still need
83- access to the jars for the Scala compiler for compilation and other
84- tasks. You can provide them by either declaring a dependency in the
85- ` scala-tool ` configuration or by explicitly defining ` scalaInstance ` .
86-
87- In the first case, add the ` scala-tool ` configuration and add a
88- dependency on ` scala-compiler ` in this configuration. The organization
89- is not important, but sbt needs the module name to be ` scala-compiler `
90- and ` scala-library ` in order to handle those jars appropriately. For
83+ access to the JARs for the Scala toochain for compilation and other
84+ tasks. You can provide them by either declaring a dependency in the toolchain configurations or by explicitly defining ` scalaInstance ` .
85+
86+ In the first case, add the toolchain configurations and add an appropriate toochain dependency on the configurations. For
9187example,
9288
9389``` scala
90+ import Configurations .{ ScalaDocTool , ScalaReplTool , ScalaTool , ZincTool }
91+
9492managedScalaInstance := false
9593
9694// Add the configuration for the dependencies on Scala tool jars
97- // You can also use a manually constructed configuration like:
98- // config("scala-tool").hide
99- ivyConfigurations += Configurations .ScalaTool
95+ ivyConfigurations ++= Seq (ScalaDocTool , ScalaReplTool , ScalaTool , ZincTool )
10096
101- // Add the usual dependency on the library as well on the compiler in the
102- // 'scala-tool' configuration
10397libraryDependencies ++= Seq (
104- " org.scala-lang" % " scala-library" % scalaVersion.value,
105- " org.scala-lang" % " scala-compiler" % scalaVersion.value % " scala-tool"
98+ // 1. Add the standard library (scala-library for 2.x, scala3-library_3 for 3.x)
99+ " org.scala-lang" % " scala-library" % scalaVersion.value,
100+ // 2. Add the compiler
101+ " org.scala-lang" % " scala-compiler" % scalaVersion.value % ScalaTool ,
102+ // 3. Add the pre-compiled compiler bridge, if any
103+ " org.scala-lang" % " scala2-sbt-bridge" % scalaVersion.value % ZincTool ,
104+ // 4. Add the scala-doc
105+ " org.scala-lang" % " scala-compiler" % scalaVersion.value % ScalaDocTool ,
106+ // 5. Add the repl
107+ " org.scala-lang" % " scala-compiler" % scalaVersion.value % ScalaReplTool ,
106108)
107109```
108110
0 commit comments