SBT 无法在 ARM64 Apple 芯片上启动,出现错误找不到所需的组件 'xsbti'

SBT fails to launch on ARM64 Apple silicon with error Could not find required component 'xsbti'

当我使用命令启动 SBT 1.5 时,该命令又会为项目启动版本 0.13

❯ sbt -v
[sbt_options] declare -a sbt_options='()'
[process_args] java_version = '8'
# Executing command line:
java
-Dfile.encoding=UTF-8
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
-jar
/opt/homebrew/Cellar/sbt/1.5.0/libexec/bin/sbt-launch.jar

[info] Loading global plugins from /Users/viswanath/.sbt/0.13/plugins
[info] Updating {file:/Users/viswanath/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.

我收到以下错误

[error] (compile:compileIncremental) sbt.InvalidComponent: Could not find required component 'xsbti'

在我的 MacBookPro 上,配备 M1 处理器(a.k.a Apple 芯片),采用 ARM64 架构。关于如何解决此问题的任何线索?

注意:捆绑的 SBT 在 IntelliJ 上运行良好

将项目的SBT版本升级到1.5.0,问题消失。 See this githib issue for more information.

或者,check this workaround 在 SBT 1.5.0 上以交互模式启动 SBT。

sbt -Dsbt.boot.directory=/tmp/boot1 -Dsbt.launcher.coursier=false

尝试使用 SDKMAN

安装
curl -s "https://get.sdkman.io" | bash

source "$HOME/.sdkman/bin/sdkman-init.sh"

sdk install java

sdk install sbt

sbt compile