Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt console how to update to latest Scala version?

Tags:

sbt

I have installed sbt using the instructions in Installing sbt on Linux.

$ sbt --version
sbt launcher version **0.13.8**
$ sbt console
[info] Starting scala interpreter...
[info] 
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.7.0_79).

How to configure (or update) sbt so that sbt console uses the latest Scala version 2.11.6?

like image 820
Polymerase Avatar asked May 18 '15 17:05

Polymerase


People also ask

How do I specify the version of Scala in SBT?

It is recommended to explicitly specify the version of Scala. sbt adds a dependency on the Scala standard library by default. To disable this behavior, set the autoScalaLibrary setting to false. To set the Scala version in all scopes to a specific value, use the ++ command. For example, to temporarily use Scala 2.10.4, run:

What is scalaversion in SBT?

The scalaVersion configures the version of Scala used for compilation. By default, sbt also adds a dependency on the Scala library with this version. See the next section for how to disable this automatic dependency. If the Scala version is not specified, the version sbt was built against is used.

How do I change the Scala version in a specific scope?

To set the Scala version in all scopes to a specific value, use the ++ command. For example, to temporarily use Scala 2.10.4, run: Defining the scalaHome setting with the path to the Scala home directory will use that Scala installation. sbt still requires scalaVersion to be set when a local Scala version is used. For example, See cross building .

Where can I download the latest version of Scala?

The Scala Web Site ( downloads here) provides a variety of installers and tarballs / Zip archives for every release they've made. Mac OS X users can use HomeBrew to get up-to-date SBT and Scala. Indeed, setting scalaVersion is an easy way to get test out a new version before you commit to upgrading.


1 Answers

Create a build.sbt file and enter the scalaVersion:

scalaVersion := "2.11.5"

Run sbt console in the same directory with your build.sbt and it will load the version you specified.

...:sbttest/ $ sbt console                                                                                                                                                                                                    [10:55:53]
[info] Loading global plugins from /home/.../.sbt/0.13/plugins
[info] Set current project to sbttest (in build file:/tmp/sbttest/)
[info] Starting scala interpreter...
[info] 
Welcome to Scala version 2.11.5 (OpenJDK 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 
like image 146
Brian Avatar answered Sep 20 '22 05:09

Brian