IntelliJ 找不到任何声明 [英] IntelliJ cannot find any declarations
问题描述
我完全卸载了 IntelliJ,现在重新安装并导入了我的项目.我使用 gradle 导入,可以看到我项目中的所有文件.但是,当我打开一个文件时,我无法通过执行 cmd + 单击找到任何要转到的声明.我有 Java 7 SDK 设置,我什至无法进入我自己项目中的类声明.转到像 String
或 List
这样的 Java 核心类也不起作用.如何让 IDE 能够找到我的类?
I completely uninstalled IntelliJ and have now reinstalled and imported my project. I imported using gradle and can see all of the files in my project present. However, when I open a file I can't find any declaration to go to by doing cmd + click. I have the Java 7 SDK setup, and I can't even go to the declaration of classes in my own project. Going to a Java core class like String
or List
doesn't work either. How can I enable the IDE to be able to find my classes?
我使用的是 OSX Yosemite,IntelliJ 2016.1.2 build 145.972.
I'm on OSX Yosemite, IntelliJ 2016.1.2 build 145.972.
推荐答案
我遇到了同样的问题,花了将近 15-16 个小时来清理、重建、使缓存失效、将 Idea 从 16.3 升级到 17.2,但都是徒劳的.我们有一个 Maven 管理的项目,并且构建曾经是成功的,但由于 Idea 看不到文件,因此无法在声明/实现之间导航.
I faced the same issue and spent almost 15-16 tiring hours to clean, rebuild, invalidate-cache, upgrade Idea from 16.3 to 17.2, all in vain. We have a Maven managed project and the build used to be successful but just couldn't navigate between declaration/implementations as Idea couldn't see the files.
在无休止地尝试解决此问题后,我终于意识到是 IDEA 设置导致了所有头痛.这就是我所做的(Windows系统):
After endlessly trying to fix this, it finally dawned to me that it's the IDEA settings causing all the headache. This is what I did (Windows system):
- 退出 IDE
- 递归删除项目目录中所有
.iml
文件 del/s/q "C:Dev runk*.iml" - 查找并删除所有
.idea
文件夹 - 删除
.IntelliJIdea2017.2system 下caches、index、LocalHistory文件夹的内容 - 打开 Idea 并导入项目 ....
- Exit IDE
- Recursively delete all
.iml
files from project directory del /s /q "C:Dev runk*.iml" - Find and delete all
.idea
folders - Delete contents of the caches, index, and LocalHistory folders under
<user_home>.IntelliJIdea2017.2system
- Open Idea and import project ....
VOILAAAAAAAAAAAA...!!我希望这能帮助一个痛苦的灵魂
VOILAAAAAAAAAAAA...!! I hope this helps a poor soul in pain
这篇关于IntelliJ 找不到任何声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!