"Cannot resolve symbol …" for all the Java classes

Answered

I just switched to the LEDA EAP (122.264), with a project having a mix of Java and Scala code. The project compile fine, but:

  • In the editor, in both Java and Scala file, any reference to a Java class which is part of the project is highlighted in red with the error "Cannot resolve symbol …".
  • References to classes in libraries are OK
  • References to Scala classes in the project are OK.


How is that possible, and what can I do to solve this?

Alex

12 comments
Comment actions Permalink

Try File | Invalidate Caches?

17
Comment actions Permalink

Hi Dmitry,

Yes, that did it. You're the man! Thank you,

Alex

0
Comment actions Permalink

I also have the same issue where my web module is not able to refer to my service modules. The project is building fine with mvn clean install, server starts but somehow I see the error - 'cannot resolve symbol' 

I tried other options such as Invalidated Caches/restart and deleted Caches files from a directory but no luck

IDE version installed - 2017.3 Ultimate

0
Comment actions Permalink

Please try to delete .idea directory and reimport the project from Maven. In case the issue persists, report at https://intellij-support.jetbrains.com/hc/requests/new and attach a sample project to reproduce it.

0
Comment actions Permalink

Hi Dmitry,

 

Your solution worked for me. Thanks

0
Comment actions Permalink

@Dmitry it worked like charms. Thank you.

0
Comment actions Permalink

@Dmitry, you saved my ass @ 2020.1.29

0
Comment actions Permalink

Some time it may be an issue where in you have disabled Enable-Auto Import on IntelliJ.

In this case please update project build file (pom or build.gradle) file and then do manual import changes.

This will reflect changes in the dependencies and should solve the problem.

0
Comment actions Permalink

Hi @Dmitry ,

Your answer solved my problem. Thank you from 2020.

0
Comment actions Permalink

The other solution works for me:

  1. close project
  2. rm *.iml
  3. rm -rf .idea
  4. from IntelliJ, New -> Project from Existing Sources, choose pom.xml under the project
0
Comment actions Permalink

Deleting .idea, .gradle and .build, I've tried invalidate caches, I've tried deleting the entire clone of the repository and starting over.  None of these seem to work.  Occasionally one seems to work for a little while but then the problem returns.  Is someone aware of an open issue that this is getting worked on?

0
Comment actions Permalink

Hello Aaron,

Please attach idea.log ("Help | Show Log in...") after restarting IDE.

0

Please sign in to leave a comment.