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?
I'm on OSX Yosemite, IntelliJ 2016.1.2 build 145.972.
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.
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):
.iml
files from project directory del /s /q "C:\\Dev\\trunk\\*.iml".idea
folders<user_home>\\.IntelliJIdea2017.2\\system
VOILAAAAAAAAAAAA...!! I hope this helps a poor soul in pain
I had the same issue with idea and I was trying to open a maven project but the pom files where not identified. So right clicking on the pom file and choosing "add as maven project" did all the magic for me :)
Had the same problem. But only on my own methods.
Just fixed it by invalidating cache: (File-> Invalidate Caches/Restart)
I was having similar issues in my IntelliJ mvn project. Pom.xml was not recognized. What worked for me was right click on the pom.xml and then add as a maven project.
Most of the times there has been a problem with building the cache of the IDE, or something related.
Most probably, File -> Invalidate Caches / Restart
, will resolve this problem, just let the IDE finalize it's caching.
右键单击您的 src 文件夹并选择选项“标记目录为”--“源根目录”,然后再次右键单击您的项目并选择“重新格式化代码”(在此下也选择清理代码),这将工作正常。
Your source folders where your Symbols are (Classes) are need to be configured as "Content Root".
Once done you should be able to navigate to your symbols.
I got this problem on Big Sur. Solution: File -> Invalidate Caches. After that press Option + Enter on every red field.
I found this cannot find declaration to go to
problem once in my Maven project. The reason for this was just that one of the sub-projects in my project did not import as maven project correctly.
In my case, I just updated my IntelliJ to Ultimate 2018.2 and all of my projects suddenly cannot find the implementations and the 'src' folders - it turned out IntelliJ removed the type of project (eg Maven).
What I did is:
Right click on the root project > Add Framework support... > Look for Maven (in my case) > Wait to re-index again > Then it worked again.
UPDATE 2:
I have always been encountering this when I update IntelliJ (2019.1.1 Ultimate Edition). Just click the refresh button of Maven Tab and it should re-index your current project as Maven Project:
确保包含已编译类和库的目录被标记为源根。
One of the reason can be that it is not able to detect the pom.xml(or gradle file) and thats why not able to set it as a maven project(or gradle).
You can manually set it up as a maven(or gradle) project by selecting your pom.xml(or gradle file)
IDEA may ignore some of your maven dependency files. The "External Libraries" node in your project structure might be empty or incomplete.
Go to:
Came across the same issue and in my case (Java project), I had to include all the dependent jars in the project's libraries section.
File -> Project Structure -> Libraries
I had to add my project dependent jars in the above section (for example; project/web/lib/). After doing so, all resolved fine. I hope this will help someone.
I too faced this issue. I've tried the solutions mentioned here. The issue seems not with the source folder.
For me the issue occurred when I installed a new version of IntelliJ, was using 2019 version moved to 2020 version. The project got opened in the new version but the declarations were missing.
I fixed this by :
- File>Project Structure. - Under Project Settings go to Modules. Here you should see the different project folders, for me it was not there. - Click the + button on top and click Import Module. - Select the root pom.xml and wait for the indexing to complete.
After the indexing is done all the declarations were working.
我在 Goland JetBrain 上遇到了类似的问题,对我有用的类似于@user8382868 所说的,但我只关闭了 IDE,将文件夹.idea
文件重命名为.idea.old
,重新打开项目后一切正常。
For Java based project, this is what worked for me :-
-Download Intellij 2020.3.4 version instead of 2021.1.1
-Add configuration, plugins.
-Configure settings, Project Structure
-Right click on the root folder -> Mark Directory as -> Sources Root
-File -> Invalidate caches/restart -> Invalidate and Restart
None of the methods listed in this channel works for me. However, I am able to resolve it using the following method, and I hope that it works for you too.
Right Click the pom.xml file and then select "Maven". After that, click "Import Maven Project"
In my case I was using a gradle project with subprojects. The reason IntelliJ couldn't find declarations was that the subprojects were not built.
After investigating why subprojects were not built, I found out that using "auto-import" was breaking the subprojects.
After importing the project from build.gradle
without auto-import , it worked for me.
就其价值而言,在 Pycharm 中它是:右键单击根文件夹-> 将目录标记为-> Sources Root
Same Problem for Python Project!!!
I tried to make a clean new intellij project and updated everything. Tried different virtualenvs but nothing worked out.
UNTIL I uninstalled the Python Plugin + Restart IntelliJ + Intall Python Plugin + Restart IntelliJ again. I'm not sure if this is a "real" solution, but it solved my issue.
Maybe you can try something familar for Java "Plugin"/JDK?
In my case, none of the above helped. Only upgrade of Intellij from 2017.3 to 2018.2 helped.
Do not try 2018.1 as it had a bug wherein the Find files popup would not come up.
I was facing the same issue, so here are the steps I followed:
Try this. it works for me
I had the same issue. what i did was. Select your project >right click> go to settings> plugins > search for cucumber > and then re-bundled the plugin and restart your intellij. It should fix the issue.
如果您认为所有依赖项都在那里,则右键单击 pom.xml 并作为 maven 项目
Just run below commands
mvn idea:clean
mvn idea:idea
Nothing above worked for me unfortunately. I deleted all downloaded dependencies from .m2\\repository and did a mvn clean install to download them again. (Although i did not have any issues in the pom.xml at the first place)
That worked for me.
Python project
Along with setting the correct interpreter through the following settings path
File > Settings > Project > Python Interpreter
I also updated the project structure's content root to be the src
directory
File > Settings > Project > Project Structure
- remove current content root
- add content root to point at src
The same issues was on Android Studio Bumblebee in XML layout file. Switching (checkout) to another branch on git and coming back to the original branch solved the issue.
The answers provided here helped some, but not completely. This is because, for a multi-project solution where classes import classes from other projects, you will need to mark all relevant projects as Sources Root
. Marking the solution folder as Sources Root
will not work.
Also, I do recommend invalidating all of the caches and re-opening the solution.
If you are new to IntelliJ u May take some time to understand IntelliJ. If a Code has written in Java and using cucumber framework then we have two main files -
Goal : what are things we have defined in feature file it must be navigate towards Step Definition File. (Ctrl +click ) Note :feature file has to contain some colourful gherkins keywords too .if it's not follow the below steps
Solution : go to file >>settings >> plugins - search “Cucumber for Java” Add the plugin restart IntelliJ it will work for sure .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.