Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT + Idea 13 => Cannot resolve symbol

I'm using SBT + Idea 13.1.1 and I have all my SBT file in red:

name := "Transformer"

version := "1.0"

libraryDependencies ++= Seq(
  "com.github.scopt" %% "scopt" % "3.2.0",
  "org.scalatest" % "scalatest_2.10" % "2.1.0" % "test"
)

It's saying

Cannot resolve symbol name/version

But Seq is ok. But it's all good to run the app from SBT cmd or even from Idea directly running the main or scalatests. I know it's not a lot information to troubleshoot but I don't know what to check else. Tell me if you have an idea I'll provide everything.

Cheers

like image 827
Joan Avatar asked Apr 03 '14 18:04

Joan


3 Answers

To fix this, remove the folder .idea and reimport the project.

The root cause remains a mystery...

like image 104
Joan Avatar answered Nov 19 '22 18:11

Joan


I had a similar problem when I updated to SBT 0.13.7. IntelliJ started marking operators such as := and ++ in red with message "Cannot resolve symbol"

My steps to fix this solution were as follows:

  1. In IntelliJ under Files | Settings, I switched my SBT Runner to use a Custom Launcher (and gave my path to sbt-launch.jar which for me was /opt/sbt/bin/sbt-launch.jar).

  2. After testing that I can still compile after #1 above, I then had to invalidate the cache and restart; under Files | Invalidate Caches / Restart...

That's it! :-)

like image 32
Jono Avatar answered Nov 19 '22 18:11

Jono


In case none of the other solutions work and you are in the same boat as me, where you see a Cannot resolve symbol ... in the build.sbt and all files that have sbt dependencies, and where there are no sbt dependencies in External Libraries, running File | New | Module from Existing Sources... and selecting the build.sbt may fix it for you as it fixed it for me.

like image 3
artin2 Avatar answered Nov 19 '22 18:11

artin2