Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ show errors in scala source files but the project compiles successfully

I'm working with project in intellij IDEA IDE based in maven. I can perform all maven goals but IntelliJ is showing a lot of errors in the source code like bellow:

enter image description here

Everything worked fine a few hours ago. I don't understand why the IDE continue showing errors. When I rebuild or compile the entire project (CTRL + F9) or a single scala class I always receive a success message like that:

enter image description here

I already had configured scala plugin before, so I don't know what is happen.

thanks for your help

like image 211
Bera Avatar asked Feb 24 '13 14:02

Bera


People also ask

Why is IntelliJ not showing compilation errors?

In "Settings" --> Build, Execution, Deployment --> "Compiler" check the checkbox "Build project automatically". This will immediately show any compile errors in the project tree.

How do I add Scala to global library in IntelliJ?

On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.


2 Answers

Sometimes the IntelliJ cache gets corrupted. You can fix this by the following:

File > "Invalidate Caches / Restart"

After choosing "Invalidate and Restart" when prompted, IntelliJ will restart and rebuild its cache.

like image 184
uris Avatar answered Sep 29 '22 13:09

uris


If IDEA has lost track of obviously correct types such as Database or DateTime it probably means the configuration of the project is wrong or corrupted. Most commonly it does not have the required 3rd part dependencies such as Joda Time.

If you're not already doing so, define your project solely in SBT and use the sbt-idea plug-in to produce your IDEA project definition. Then whenever you change the project dependencies, re-run gen-idea to regenerate your IDEA project files. No muss, no fuss.

like image 34
Randall Schulz Avatar answered Sep 29 '22 11:09

Randall Schulz