Seth Tisue Seth Tisue - 19 days ago 5
Scala Question

How do I tell sbt to use a nightly build of Scala 2.11 or 2.12?

I want to test my code against the latest bleeding edge Scala.

The answer for Scala 2.10 doesn't work anymore. What do I do?

Answer

Quickly:

resolvers += "nightlies" at
  "https://scala-ci.typesafe.com/artifactory/scala-release-temp/"
scalaVersion := "2.12.1-abcd123-nightly"
scalaBinaryVersion := "2.12"  // or "2.11"

in the second line, substitute a version number from Jenkins (2.12, 2.11)

Longer version:

The Scala team no longer publishes -SNAPSHOT versions of Scala. (Starting that again could be a community contribution; see this ticket.)

But the team does publish nightly builds, each with its own fixed version number. The version number of a nightly looks like e.g. 2.12.1-abcd123-nightly.

To tell sbt to use one of these nightlies, you need to do three things.

First, add the resolver where the nightlies are kept:

resolvers += "nightlies" at
  "https://scala-ci.typesafe.com/artifactory/scala-release-temp/"

Second, specify the Scala version:

scalaVersion := "2.12.1-abcd123-nightly"

But that isn't a real version number. Substitute a version number containing the 7-character SHA of a commit in the scala/scala repository for which a nightly build was published. You can look up the most recent published version by looking here: 2.12 or 2.11).

Third, tell sbt that the nightly is binary compatible with normal releases:

scalaBinaryVersion := "2.12"  // or "2.11"

(This last step will become unnecessary once https://github.com/scala/scala-dev/issues/252 gets fixed.)