【问题标题】:IntelliJ: Symbol 'type org.scalatest.compatible.Assertion' is missing from the classpathIntelliJ:类路径中缺少符号 'type org.scalatest.compatible.Assertion'
【发布时间】:2021-10-26 09:14:46
【问题描述】:

编写scala测试,遇到错误:

Symbol 'type org.scalatest.compatible.Assertion' is missing from the classpath.
This symbol is required by 'type org.scalatest.Assertion'.
Make sure that type Assertion is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'package.class' was compiled against an incompatible version of org.scalatest.compatible.

我的 build.sbt 很简单:

import sbt.Keys.libraryDependencies

ThisBuild / scalaVersion     := "2.13.2"
ThisBuild / version          := "0.1.0-SNAPSHOT"
ThisBuild / organization     := "com.example"
ThisBuild / organizationName := "example"

lazy val root = (project in file("."))
  .settings(
    name := "myproj",
    libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.9",
    libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.9" % "test",
    libraryDependencies += "org.scalatest" %% "scalatest-funsuite" % "3.2.9" % "test",
    libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
    )

仅当我在 IntelliJ 中构建项目时才会出现此问题。使用 sbt 本身可以很好地编译。

sbt version in this project: 1.3.10
sbt script version: 1.3.6

知道如何在 IntelliJ 中修复它吗?

【问题讨论】:

  • 明显的建议但值得一提 - 你试过File -> Invalidate Caches吗?

标签: scala intellij-idea sbt


【解决方案1】:

我解决了大部分与 IntelliJ 被破坏有关的问题:

  1. sbt clean compile 在终端的根文件夹中
  2. View -> Tool Windows -> sbt 和标签内Reload SBT project(右键单击项目)

【讨论】:

    猜你喜欢
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-07
    • 1970-01-01
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多