intelliJ "unknown artifact. Not resolved or indexed" for scalatest with scala 2.13.1, sbt 1.3.3

intelliJ "unknown artifact. Not resolved or indexed" for scalatest with scala 2.13.1, sbt 1.3.3

IntelliJ 中的以下组合给出了 "unknown artifact" 错误。

以下组合不报错

来自类似问题的建议 没有帮助:

我错过了什么?

Github 上的最小项目:https://github.com/hcetinkaya/sbt-scalatest-error-demo

我的系统:

环境(更新):

OS: Windows 10.0 (Build 15063) VM on a VMWare 7.1
Scala Plugin: 2019.2.36
IntelliJ IDEA: 2019.2.3 (Ultimate Edition)
Build #IU-192.6817.14, built on September 23, 2019 
with 
    Runtime version: 11.0.4+10-b304.69 amd64
    VM: OpenJDK 64-Bit Server VM by Jetbrains

JAVA_HOME: E:\apps\java\jdk-13
SBT_HOME: E:\apps\sbt\sbt-1.3.3\sbt

build.sbt:

scalaVersion := "2.13.1" // "2.12.10" is OK. "2.13.1" gives an "unknown artifact" error
lazy val root = project.in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.8" % Test
    )
)

build.properties:

sbt.version = 1.3.3

IntelliJ 项目结构:

Project Structure 
    Project
        Project SDK: java 13 language level: 13
    Modules
        all sources ->  language level: 13 /project default
                        dependencies Module SDK: project sdk

IntelliJ 设置:

Build, Execution, Deployment
    Build Tools
        sbt 
            jre: E:\apps\java\jdk-13
            Launcher: E:\apps\sbt\sbt-1.3.3\bin\sbt-launch.jar
    Compiler
        Scala Compiler Server
            Use compile Server for Scala: checked
            JDK: Project default
            JVM max heap, MB: 1024

更新:

sbt 产生以下错误日志:

error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/null)

详细信息(切碎):

[info] Loading global plugins from C:\Users\hce\.sbt.0\plugins
[info] Updating ProjectRef(uri("file:/C:/Users/hce/.sbt/1.0/plugins/"), "global-plugins")...
[info] Done updating.
[info] Loading project definition from E:\learn\sbt\sbt-getting-started\project
[info] Updating ProjectRef(uri("file:/E:/learn/sbt/sbt-getting-started/project/"), "sbt-getting-started-build")...
[info] Done updating.
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/null)
[error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
[error]         at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:176)
[error]         at scala.tools.nsc.classpath.JrtClassPath.asURLs(DirectoryClassPath.scala:204)
[error]         at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$asURLs(AggregateClassPath.scala:55)
[error]         at scala.collection.TraversableLike.$anonfun$flatMap(TraversableLike.scala:240)
[error]         at scala.collection.Iterator.foreach(Iterator.scala:937)
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:937)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
[error]         at scala.collection.IterableLike.foreach(IterableLike.scala:70)
...
[error] Caused by: java.lang.RuntimeException: /packages cannot be represented as URI
[error]         at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:176)
[error]         at scala.tools.nsc.classpath.JrtClassPath.asURLs(DirectoryClassPath.scala:204)
[error]         at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$asURLs(AggregateClassPath.scala:55)
[error]         at scala.collection.TraversableLike.$anonfun$flatMap(TraversableLike.scala:240)
[error]         at scala.collection.Iterator.foreach(Iterator.scala:937)
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:937)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
[error]         at scala.collection.IterableLike.foreach(IterableLike.scala:70)
[error]         at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
[error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]         at scala.collection.TraversableLike.flatMap(TraversableLike.scala:240)
[error]         at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:237)
[error]         at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
[error]         at scala.tools.nsc.classpath.AggregateClassPath.asURLs(AggregateClassPath.scala:55)
...
[error]         at xsbt.boot.Launch$$anonfun$run.apply(Launch.scala:111)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:130)
[error]         at xsbt.boot.Launch$.run(Launch.scala:111)
[error]         at xsbt.boot.Launch$$anonfun$apply.apply(Launch.scala:37)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:119)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:20)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:56)
[error]         at xsbt.boot.Boot$.main(Boot.scala:18)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI

更新 2:

以下组合和步骤对我有用

步数:

IntelliJ 仍然显示 "unknown artifact" 消息,但 sbt 编译、测试有效。

我假设新安装的 IntelliJ 在为 Cousier 编译 scala2_12 桥时遇到问题。

命令行重新编译,现在在项目目录下scalatest_2.13可以看到之前没有的

null\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalatest\scalatest_2.13

以下组合和步骤对我有用

scala 2.13.1
Java OpenJDK 13.0.1 (set IntelliJ sbt options to OpenJDK)
sbt 1.3.3 (set IntelliJ sbt-launch.jar option to sbt 1.3.3 directory)

步骤:

create a new sample project in commandline (see https://www.scala-sbt.org/1.x/docs/sbt-by-example.html)
sbt compile, test should work
import this project in IntelliJ

IntelliJ 仍然显示“未知工件”消息,但 sbt 编译、测试有效。