scala 如何使用自制软件更新 SBT 版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26716921/
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 06:39:57  来源:igfitidea点击:

How to update SBT version using homebrew?

scalasbthomebrew

提问by Alessio Crestani

I installed SBT v0.12.4. Now I want to update it to v0.13.x, so I have used the command

我安装了 SBT v0.12.4。现在想更新到v0.13.x,所以用了命令

brew install sbt

It says that it has correctly installed SBT 0.13.x. but if I ask on terminal the version of SBT, it says 0.12.4. How to update it?

它说它已经正确安装了 SBT 0.13.x。但是如果我在终端上询问 SBT 的版本,它会说 0.12.4。如何更新?

回答by jsuereth

There are two sbt versions:

有两个 sbt 版本:

  1. The sbt-launcher. This is used to download and run a particular sbt version. This is what you installed with brew. If you type sbt --versionit should tell you the version of the launcher brew installed.

  2. sbt itself (for building projects). This is controlled via a project/build.propertiesfile by project. So one launcher can launch many versions of sbt, and is generally backwards compatible. To update this version, simple change the sbt.versionproperty in project/build.properties.

  1. sbt-launcher。这用于下载和运行特定的 sbt 版本。这是你用 brew 安装的。如果你输入sbt --version它应该告诉你安装的启动器 brew 的版本。

  2. sbt 本身(用于建筑项目)。这是通过 projectproject/build.properties文件控制的。所以一个启动器可以启动多个版本的 sbt,并且通常是向后兼容的。要更新此版本,简单的变化的财产。sbt.versionproject/build.properties

回答by Greg Chabala

If you want to upgrade the version of sbt installed by homebrew, use:

如果要升级 homebrew 安装的 sbt 版本,使用:

brew upgrade sbt

You can check what version of sbt is in use with sbt about

您可以检查正在使用的 sbt 版本 sbt about

回答by boole guo

check sbt version:

检查 sbt 版本:

sbt sbtVersion

upgrade sbt version:

升级sbt版本:

brew upgrade sbt  

回答by Ivan Stanislavciuc

There is an alternative sbt-launcherwith source code here paulp/sbt-extrasthat allows specifying sbt version within command line.

paulp/sbt-extras 的sbt-launcher源代码有一个替代方法,它允许在命令行中指定 sbt 版本。

Installing sbtx

安装 sbtx

brew install --HEAD paulp/extras/sbtx

Or

或者

curl -Ls https://git.io/sbt > ~/bin/sbt && chmod 0755 ~/bin/sbt

Building project with desired sbt version

使用所需的 sbt 版本构建项目

sbt -sbt-version 1.2.5 clean test