Why “could not find implicit” error in Scala + Intellij + ScalaTest + Scalactic but not from sbt

前端 未结 6 1318
清歌不尽
清歌不尽 2021-01-07 23:55

I have this code that is working 100% from sbt , executing sbt test but throw a compilation error in Intellij Idea.

import org.         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-08 00:03

    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.

提交回复
热议问题