Skip to content

Adding scoverage plugin broke running tests via idea with java.lang.NoClassDefFoundError: scoverage/Invoker$ #272

Closed
@apple-corps

Description

@apple-corps

I've become accustomed to running my ScalaTest unit tests via idea. Then I added the scoverage plugin and ran the tests via sbt from shell and got coverage reports as documented.

Then when I went back to idea to run a single test I got the discussed java.lang.NoClassDefFoundError: scoverage/Invoker$

I tried adding libraryDependencies += "org.scoverage" %% "scalac-scoverage-runtime" % "1.5.1" as suggested in #115 but it didn't work.

I'm putting my relatively clean and simple build.sbt below.

Why does idea need to use this invoker when running a single test via the UI?

name := "scala-org-kafka"
version := ".1"
scalaVersion := "2.11.8"
organization := "org.example.scala"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.1"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.0"
libraryDependencies += "org.apache.spark" % "spark-streaming_2.11" % "2.4.0"
libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.11" % "2.4.0"
libraryDependencies += "org.apache.spark" %% "spark-sql-kafka-0-10" % "2.4.0"

mainClass in assembly := Some("org.example.scala.SparkContextProvider")
assemblyMergeStrategy in assembly := {
  case "META-INF/services/org.apache.spark.sql.sources.DataSourceRegister" => MergeStrategy.concat
  case PathList("META-INF", xs @ _*) => MergeStrategy.discard
  case _ => MergeStrategy.first

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions