Sbt console How to upgrade to the latest version of Scala?

I 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 version of Scala 2.11.6 ?

+6
source share
3 answers

Create a build.sbt file and enter scalaVersion :

 scalaVersion := "2.11.5" 

Run sbt console in the same directory using build.sbt and download the specified version.

 ...: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> 
+5
source

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

You can also put the build.sbt file in the .sbt/0.13/ directory:

 cat <<END > ~/.sbt/0.13/build.sbt scalaVersion := "2.11.8" END 

Then running sbt console from another place will give you your favorite version of scala . (If there is a local build.sbt file in the directory in which you are running build.sbt , the locally specified version will override the global one).

+5
source

sbt ++ 2.11.11 console

Change 2.11.11 to the version of Scala 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 +` 
+1
source

Source: https://habr.com/ru/post/987436/


All Articles