intellij's scala plugin is not recognizing symbols in build.sbt

Viewed 1168

I imported an existing working sbt project. Intellij is highlighting many things in the sbt file as errors:

lazy val core = project.in(file("core")) "Cannot resolve symbol project"

"Cannot resolve symbol file"

scalaVersion := "2.11.8" "Cannot resolve symbol scalaVersion"

I have the latest version of intellij and the latest version of the scala plugin.

2 Answers

Try this.

Click File -> Synchronize, and IntelliJ should see that everything is okay again.

If that doesn't work, IntelliJ's caches might be corrupt (this used to happen a lot more often than it does now); in that case, regenerate them by

Clicking File -> Invalidate Caches and restarting the IDE

I faced with this problem right after I saw your question. I have tried everything Junaid said but it did not work. Afterwards, I have re-imported the project by selecting build.sbt file and everything worked well.

Whenever IntelliJ could not find Scala SDK or show errors on build.sbt file, just try to re-import project by selecting build.sbt. It should work.

I hope it helps!

Related