20

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

(Or, I want to use an experimental Scala 3 feature, which are only available in nightly builds.)

What do I do?

1 Answer 1

34

There is now (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.

4
  • 2
    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. Commented Mar 9, 2017 at 7:58
  • 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)
    – retronym
    Commented Jun 5, 2017 at 1:40
  • 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"), Commented Oct 24, 2018 at 13:33
  • 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)
    – Seth Tisue
    Commented Oct 24, 2018 at 21:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.