Please goto File > Settings (Ctrl+Alt+S, Windows)/Preferences (Mac) > Plugin Search for "scala". Uninstall Scala plugin.. Restart IDE. Reinstall it. Restart IDE and install the plugin. Everything works OK
If your project is Gradle-based, one possibility is that the project is looking for Scala libraries in the .m2 cache that don't exist. To confirm, open "Project Structure...", go to "Libraries", and examine the list for "Gradle: org.scala-lang:..." that contain errors related to missing files.
If this is the issue, simply re-import the project from scratch.
In the more recent versions of IntelliJ (2020.1.1) at the time of writing this, I was able to solve this problem by removing the Scala SDK configured in the Global Libraries
section in IntelliJ and hitting File > Invalid Caches / Restart
.
I'm not sure why this solved the issue, perhaps recent versions of the IDE now have automatic detection of Scala compiler JAR files from Maven (which I'm using to build my project).
SOLVED as Follow:
In project settings, you need to manually add:
Module and dependencies to JDK AND Scala JAR
In library, Add MANUALLY the JAR of Scala (IntelliJ does not add those JAR. it creates compile issues).
in Global library, check the JAR of scala are same.
There is an option to see the DEBUG in verbose mode:
https://intellij-support.jetbrains.com/hc/articles/207241085
This is very useful.
https://www.jetbrains.com/help/idea/invalidate-caches.html
IntelliJ IDEA caches a great number of files, therefore the system cache may become overloaded. Sometimes the caches will never be needed again, for example, if you work with frequent short-term projects.
When you invalidate the cache, IntelliJ IDEA rebuilds all projects ever run in the current version of the IDE.
Clear the system cache 1.From the main menu, select File | Invalidate Caches / Restart.
2.In the Invalidate Caches dialog, select an action. You can invalidate the caches and restart the IDE or just restart the IDE.
This worked for me.
Open File -> Project Structure
Go to Libraries under Project Settings
Click on the minus button on the erroring Scala library
Open an existing Scala class in IntelliJ and you will see the prompt to set up Scala SDK and click on that
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With