IntelliJ: Symbol 'type org.scalatest.compatible.Assertion' is missing from the classpath

Viewed 293

Writing scala tests, I am encountering an error:

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.

My build.sbt is very simple:

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",
    )

This problem only occurs when I build my project within IntelliJ. Using sbt itself it compiles well.

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

Any idea of how to fix it in IntelliJ?

1 Answers

Most of the problems related to IntelliJ being broken I resolve by doing so:

  1. sbt clean compile in terminal on root folder
  2. View -> Tool Windows -> sbt and within tab Reload SBT project (right click on project)
Related