sbt 控制台如何更新到最新的 Scala 版本?
sbt console how to update to latest Scala version?
我已经按照 Installing sbt on Linux 中的说明安装了 sbt。
$ 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).
如何配置(或更新)sbt 以便 sbt console
使用最新的 Scala 版本 2.11.6?
创建一个build.sbt
文件并输入scalaVersion
:
scalaVersion := "2.11.5"
运行 sbt console
与您的 build.sbt
在同一目录中,它将加载您指定的版本。
...: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>
Run sbt console in the same directory with your build.sbt and it will load the version you specified.
您也可以将 build.sbt
文件放在 .sbt/0.13/
目录中:
cat <<END > ~/.sbt/0.13/build.sbt
scalaVersion := "2.11.8"
END
然后,从其他任何地方执行 sbt console
将得到您最喜欢的 scala
版本。 (如果您执行 sbt
的目录中有本地 build.sbt
文件,则本地指定的版本将覆盖全局)。
sbt ++ 2.11.11 console
将 2.11.11 更改为您选择的 Scala 版本。
来自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 +`
我已经按照 Installing sbt on Linux 中的说明安装了 sbt。
$ 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).
如何配置(或更新)sbt 以便 sbt console
使用最新的 Scala 版本 2.11.6?
创建一个build.sbt
文件并输入scalaVersion
:
scalaVersion := "2.11.5"
运行 sbt console
与您的 build.sbt
在同一目录中,它将加载您指定的版本。
...: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>
Run sbt console in the same directory with your build.sbt and it will load the version you specified.
您也可以将 build.sbt
文件放在 .sbt/0.13/
目录中:
cat <<END > ~/.sbt/0.13/build.sbt
scalaVersion := "2.11.8"
END
然后,从其他任何地方执行 sbt console
将得到您最喜欢的 scala
版本。 (如果您执行 sbt
的目录中有本地 build.sbt
文件,则本地指定的版本将覆盖全局)。
sbt ++ 2.11.11 console
将 2.11.11 更改为您选择的 Scala 版本。
来自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 +`