scala "console"命令给出错误"Missing scala-library.jar"



在sbt下,如果我给"控制台"来启动REPL shell,我会得到以下错误。

[error] stack trace is suppressed; run 'last scalaInstance' for the full output
[error] (scalaInstance) Missing scala-library.jar
[error] Total time: 1 s, completed Oct 7, 2019 12:45:07 PM
$ sbt scalaVersion
[info] Loading global plugins from C:..plugins
[info] Loading settings for project test from plugins.sbt ...
[info] Loading project definition from C:xxtestproject
[info] Loading settings for project root from build.sbt ...
[info] scalaVersion
[info]  2.11.12
$ sbt sbtVersion
[info] sbtVersion
[info]  1.3.0

尝试assemblyOption in set: = (assemblyOption in set) .value.copy (includeScala = true)

来源: https://github.com/sbt/sbt-assembly

如果这不能解决问题,则可能是与您可能已安装的插件的兼容性问题,这意味着您必须删除 %HOME% 中的插件目录。 和 %HOME%.ivy2,因为它在本地缓存了一些工件。

如果您找不到该插件,请尝试删除 %HOME%.ivy2 并再次运行控制台,因为它将删除缓存的工件。

您可能想参考 https://pt.coredump.biz/questions/50313823/why-does-running-tests-through-jenkins-user-on-build-slave-fail-with-missing-scalalibraryjar

我希望它有所帮助。

有点不相关,但我在我的一个项目上遇到了这个错误,删除所有缓存(.m2、.ivy2、coursier(不足以解决这个问题。我还必须清除我的 .sbt 文件夹(我假设清空引导目录(。请务必备份您可能仍需要的任何设置。

您可以尝试在 SBT 构建中更新 scala 版本吗? 例如

scalaVersion := "2.13.0" 

最新更新