Scala unit-tests in IntelliJ fail with java.lang.NoClassDefFoundError scoverage/Invoker$

1.4k Views Asked by At

Tests run without any problem in sbt, but when you need them in IntelliJ, they fail.

A needed class was not found. This could be due to an error in your runpath.
Missing class: scoverage/Invoker$
java.lang.NoClassDefFoundError: scoverage/Invoker$

I have seen many suggesting during the years how to fix it, but nothing really helped. :)

2

There are 2 best solutions below

0
On

Finally discovered a solution, which worked for me:

Temporarely disable scoverage plugin for sbt project(s) in questions

lazy val pipeline: Project = project
...
  .disablePlugins(ScoverageSbtPlugin) // <-- temp

Bonus: tests are running faster as well.

0
On

Just perform a rebuild (Build -> Rebuild Project).

Intellij is probably storing some temporary/cached files and rebuilding clears them.