刚才用Intellij正在写代码的过程中,电脑突然死机黑屏了,然后强制关机后重启电脑,发现点开项目哪个文件,哪个文件报错,报错原因是类引入找不到,maven重新clean,install,package都不好使,引入类的那条语句,包可以点进去查看,发现引入的类确实存在,但编译就是显示类不存在。
解决办法:
file–invalidate caches/restart
把缓存清理并重启就可以了。
网上其它不靠谱解决方案:
1,重启Intellij
2,重启电脑
3,重新配置jdk
4,重新配置tomcat
5,项目删了重新从git上下载
这五条都试了,不好使。
intellij清理缓存并重启的官方解释:
**Cleaning System Cache**
IntelliJ IDEA caches a great number of files, therefore the system cache may one day become overloaded. In certain situations the caches will never be needed again, for example, if you work with frequent short-term projects. Also, the only way to solve some conflicts is to clean out the cache.
**To clean out the system caches:**
On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart IntelliJ IDEA or both.
**It is important to note the following:**
The files are not actually deleted until IntelliJ IDEA restarts.
Opening and closing a project does not result in deleting any files.
**WARNING:**
Cleaning out the system caches, keep in mind that:
It results in clearing the local history.
To avoid losing data, check in the changes to your version control system before invalidating caches.
Causes a complete rebuild of all the projects ever run in the current version of IntelliJ IDEA.