类 java.lang.UnsupportedOperationException 无法转换为类 xsbti.FullReload

Raf*_*iro 7 scala sbt

我正在尝试按照一些教程来了解有关 Scala 的更多信息,并且我正在尝试在我的计算机(MacBook Pro M1)的 IntelliJ 中使用它。我使用sdkman安装了sdk。但是,我遇到了一些关于它的错误,并且我不知道如何解决这个问题。

编辑:按照下面的建议,有关我如何安装它的更多信息:

我正在尝试LinkedIn Learning 上的 Scala 简介课程我安装了此处提供的IntelliJ 社区版本 (Apple Sillicon) ,然后使用curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz | gzip -d > cs && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup 此处提供的命令安装了 Scala 。最后,我按照此处提供的curl -s "https://get.sdkman.io" | bash内容使用并source "$HOME/.sdkman/bin/sdkman-init.sh"安装了 SDK 。

毕竟,当我进入终端并写入sbt -version或尝试在 IntelliJ 中运行某些内容时,会出现以下错误:

java.lang.ClassCastException: class java.lang.UnsupportedOperationException cannot be cast to class xsbti.FullReload (java.lang.UnsupportedOperationException is in module java.base of loader 'bootstrap'; xsbti.FullReload is in unnamed module of loader 'app')
    at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:59)
    at sbt.xMain.run(Main.scala:46)
    at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
    at xsbt.boot.Launch$.run(Launch.scala:149)
    at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
    at xsbt.boot.Launch$.launch(Launch.scala:159)
    at xsbt.boot.Launch$.apply(Launch.scala:44)
    at xsbt.boot.Launch$.apply(Launch.scala:21)
    at xsbt.boot.Boot$.runImpl(Boot.scala:78)
    at xsbt.boot.Boot$.run(Boot.scala:73)
    at xsbt.boot.Boot$.main(Boot.scala:21)
    at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.ClassCastException: class java.lang.UnsupportedOperationException cannot be cast to class xsbti.FullReload (java.lang.UnsupportedOperationException is in module java.base of loader 'bootstrap'; xsbti.FullReload is in unnamed module of loader 'app')
Run Code Online (Sandbox Code Playgroud)

我不知道这意味着什么以及如何解决这个问题。有人可以帮我吗?

noc*_*mbi 5

已经在评论中,但将其作为答案发布:

下面指定的 sbt 版本应与您实际的 sbt 版本匹配(您可以通过在项目文件夹外project/build.properties运行来获取它)。$ sbt -version

因此进行project/build.properties相应的编辑:

sbt.version=1.9.3
Run Code Online (Sandbox Code Playgroud)


Sta*_*Edd 1

我能够按照存储库xsbt中的说明进行操作,使其正常工作

修改 SBT 部分指出,

如果项目定义了project/build.properties,请删除该文件或将sbt.version更改为0.13.0-SNAPSHOT。