I am getting 'Cannot find declaration to go to' warning

Answered

I am getting 'Cannot find declaration to go to' warning when i tries to verifiy that import is successful.

I point mouse on the variable while pressing control key.

Instead of going to variable declaration, i am getting that warning .

 

Please help.

 

0
15 comments

Can you share more details of the project? Is it Maven/Gradle project? How you imported a package? Using pom.xml, build.gradle, or manually using dependencies in IntelliJ IDEA? What is the dependency name? Do you have a highlighting about the wrong import in the import statement? 

A project sample where the issue is reproduced, or at least several screenshots would help a lot. 

0

Hi Annikov,Thanks for Reaching out and asking valid questions.

This is a maven project.  I have imported the existing project into intelliJ  using Project from existing sources besides File.

The Project is importing several packages.

My Understanding: IntelliJ  don't understand where it will find those packages.Since it does not have source information. It is not find declaration.

Whenever i place mouse on package for which i need information, i get warning that 'Cannot find declaration to go to'.

0

Could the project be compiled from Maven's command line? It is needed to make sure the import is valid. 

Have you tried to re-import Maven project in Maven window? 

4

Unfortunately, I am unableto find both Maven Command Line and Reimport All Maven Projects Option.

0

"Reimport Maven project" button could be found in"Maven" tab on the right of IntelliJ IDEA window: 

https://www.jetbrains.com/help/idea/maven-projects-tool-window.html

You can even see it at your screenshot.

Maven Command Line is available in command prompt:

https://www.vogella.com/tutorials/ApacheMaven/article.html#maven_usage

 

As a general troubleshooting step, please try "Invalidate caches and restart" in "File" menu

0

When I clicked on Maven Projects, It didn't showed any project. 

0

I am confused. This project has pom.xml that mentions that it is maven project. I could not understand why intelliJ didn't consider it as maven project.

0

You can try to re-import the project from pom.xml file. Just use **File | New | Project from existing sources** and select pom.xml file. Overwrite existing files in case IntelliJ IDEA asks about that. 
Module should starts displaying in "Maven" tab after that

0

Hi ,

I am able to load the pom.xml. Now the project is shown under maven projects.

But still imports are not successful.

0

Hi,

I tried both reimport maven projects and Invalidate caches & restart. But none of this is working for me.

0

Hi,

 

My pom is also showing 16 errors. I am sharing one of those errors.

 

 

 

0

All the errors should be examined separately. Moreover, they are hardly related to IntelliJ IDEA, but to the configuration file itself. Feel free to ask the question with your project's details on StackOverflow, or similar forums. 

Sharing the project on GitHub will help other users to give a fast and proper answer. 

 

0

My case:

  • go to WebStorm Default IDE directories (C:\Users\JohnS\AppData\Roaming\JetBrains)

  • delete all files in this folder

  • reopen WebStorm

WARNING: But after these steps your JetBrains products configuration will be reset. So u can try to delete this folder WebStorm2020.1 (the name depends on WebStorm version) first and try is this will solve the problem, if not do my steps.

These steps fix for me this bug. This article helps me to find Default IDE directories for my OS: https://www.jetbrains.com/help/webstorm/tuning-the-ide.html#default-dirs

0

All solution posted by Konstantin Annikov is useless .Sorry to say that .I tried everything .I get this very frequently .Please do something .

0

Avinash15 Kumar Your issue is likely unrelated. Please contact support at https://intellij-support.jetbrains.com/hc/requests/new with more details or file a bug with the steps to reproduce at https://youtrack.jetbrains.com/newIssue?project=IDEA.

0

Please sign in to leave a comment.