I have this code that is working 100% from sbt , executing sbt test
but throw a compilation error in Intellij Idea.
import org.
Also make sure your project JDK is set to JDK 8. Scala is not compatible with JDK 11 which is the default now in IntelliJ.
The same also happened with Maven.
I had a project where everything worked fine. After the latest IntelliJ upgrade it forgot the JDK setting. I did all the steps in the answers but none of them helped. As a last resort, I reinstalled IntelliJ from scratch, checked out a clean repo (no .idea folder or .iml files) and... didn't help. Then during setting up the project again I noticed JDK 11. It rang me a bell, added JDK 8, and there you go. Test are green again.