Reputation: 6791
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?
Upvotes: 12
Views: 11726
Reputation: 3755
sbt ++ 2.11.11 console
Change 2.11.11 to the Scala version of your choice.
From sbt help ++
:
++ <scala-version> [<command>]
Changes the Scala version and runs a command.
Sets the `scalaVersion` of all projects to <scala-version> and
reloads the build.
If <command> is provided, it is then executed.
++ [<scala-version>=]<scala-home> [<command>]
Uses the Scala installation at <scala-home> by configuring the
scalaHome setting for
all projects.
If <scala-version> is specified, it is used as the value of the
scalaVersion setting.
This is important when using managed dependencies. This version
will determine the
cross-version used as well as transitive dependencies.
If <command> is provided, it is then executed.
See also `help +`
Upvotes: 3
Reputation: 111
Run sbt console in the same directory with your build.sbt and it will load the version you specified.
You can also place the build.sbt
file in the .sbt/0.13/
directory:
cat <<END > ~/.sbt/0.13/build.sbt
scalaVersion := "2.11.8"
END
Then, executing sbt console
from anywhere else will give you your favourite version of scala
. (If there is a local build.sbt
file in the directory you execute sbt
from, the locally specified version will override the global).
Upvotes: 6
Reputation: 20285
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>
Upvotes: 15