如何从命令行将 Scala 升级到更新版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14613843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 04:54:20  来源:igfitidea点击:

How to upgrade Scala to a newer version from the command line?

scalasbt

提问by Eran Medan

Is there away to upgrade the installed Scala version via sbt / other command line tool?

是否可以通过 sbt / 其他命令行工具升级已安装的 Scala 版本?

I'm sure there is a way, but I couldn't find any after a quick search, am I missing anything?

我确定有办法,但快速搜索后我找不到任何方法,我错过了什么吗?

采纳答案by Randall Schulz

Each SBT project specifies the version of Scala to use to compile and run its code. It defaults to being the version of Scala that SBT uses internally, but is always overridable.

每个 SBT 项目都指定了用于编译和运行其代码的 Scala 版本。它默认为 SBT 在内部使用的 Scala 版本,但始终是可覆盖的。

E.g.

例如

  scalaVersion := "2.10.0"

As Connor Doyle mentioned, if your OS has a package system that includes Scala (some Linux distros I know of do) and you are, for some reason obligated to use that, you are pretty much at their mercy to provide a new version on a timely basis. The Scala Web Site(downloads here) provides a variety of installers and tarballs / Zip archives for every release they've made.

正如 Connor Doyle 所提到的,如果您的操作系统有一个包含 Scala 的软件包系统(我知道的一些 Linux 发行版)并且您出于某种原因有义务使用它,那么您几乎可以任由他们在及时依据。在Scala Web站点下载点击这里)提供了多种安装程序和压缩包/ Zip文件为他们所做的每一个版本的。

Mac OS X users can use HomeBrewto get up-to-date SBT and Scala.

Mac OS X 用户可以使用HomeBrew来获取最新的 SBT 和 Scala。

回答by GatesDA

To set the project version temporarily from the command line:

从命令行临时设置项目版本:

++ 2.10.4

To set the project version permanently from the command line:

从命令行永久设置项目版本:

set scalaVersion := "2.10.4"
session save

回答by Masashi

I just executed one command line"homebrew remove scala;homebrew install scala" to update to the latest version. Isn't this enought?

我刚刚执行了一个命令行“homebrew remove scala;homebrew install scala”来更新到最新版本。这还不够吗?

I also found this link (http://wkmacura.tumblr.com/post/11577309978/installing-specific-versions-with-homebrew) and hope it works for you.

我还找到了这个链接(http://wkmacura.tumblr.com/post/11577309978/installing-specific-versions-with-homebrew),希望它对你有用。