Moving to version 2.13

Hello everyone,

Iā€™m new to Scala and I want to start my real first project. Up until now, I was using Scala 2.12.8, but I want to use version 2.13 for this project. However, when I try to execute sbt run, I have the following errors (part of a bigger error message)

[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.13: not found
[error] unresolved dependency: org.scala-lang#scala-reflect;2.13: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.13: not found

To migrate to version 2.13, I upgraded scala via Homebrew. Running scala in a terminal give me correct version

Welcome to Scala 2.13.0 (OpenJDK 64-Bit Server VM, Java 1.8.0_212).

My build.sbt looks like this

ThisBuild / scalaVersion := "2.13"
ThisBuild / organization := "com.example"

lazy val hello = (project in file("."))
  .settings(
    name := "Hello",
    libraryDependencies += "org.scalatest" % "scalatest_2.13" % "3.0.8" % "test"
  )

and the sbt version is 1.2.8. Everything was working well when I was using scala 2.12.

Thanks for the help,

Maxime

Maybe you need to use 2.13.0 instead of 2.13 as a Scala version?

2 Likes

Hello Maxime,

try scala version ā€œ2.13.0ā€ - it needs the patch part of the version.

ThisBuild / scalaVersion := "2.13.0"

The scala-test dependency can be written like this:

 libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test"

If you use two percent signs %% then sbt adds the ā€œ_2.13ā€ suffix to
the artifact (depending on value of scalaVersion).

Regards
Eike

Maxime Tremblay via Scala Users noreply@users.scala-lang.org writes:

2 Likes

Thank you, it work. Glad it was so easy.

Maxime

1 Like