21

I want to test my code against the latest bleeding-edge Scala 3 or Scala 2 nightly.

What do I do?

1 Answer 1

35

There is now (since 2024) an official documentation page covering this:

Full details are there, but a short answer is that the easiest way is with scala-cli -S 3.nightly (or 3.3.nightly for LTS, or 2.nightly for 2.13, or 2.12.nightly for 2.12).

If you aren't using scala-cli, it's not too much harder; see instructions on doc page.

Sign up to request clarification or add additional context in comments.

4 Comments

See also github.com/typelevel/scala/issues/135 ... to support compiler plugins you'll want to use CrossVersion.patch, and while you're at it you might as well use scalaOrganization.value to get Typelevel Scala compatibility too.
If you find you want to do this frequently, it is also possible to add conditionally add the extra resolver in your global SBT config (e.g. gist.github.com/retronym/61bfa9585a303cdaa204b5916124bf0c)
If you get an error mesage like org.scala-js#scalajs-compiler_2.12.8-bin-ebf8017;0.6.25: not found, one solution (that worked for me) is: libraryDependencies := libraryDependencies.value.filterNot(_.name == "scalajs-compiler"), addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.12.7" % "0.6.25"),
I have also sometimes resorted to just editing the build definition and replacing "foolib" %% "1.2.3" with "foolib_2.12.7" % "1.2.3", this comes up with anything published by full Scala version, typically compiler plugins (Scala.js, macro paradise, etc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.