IntelliJ : Why do I always have to jump through hoops to "get the red out"?

Answered

I'm using IntelliJ (Community - 2021.2.3) with a Java 8 Maven 3 project. The structure of my project is such that I have a root folder (without a maven pom file) that contains 4 maven root projects as siblings. I could choose to open these maven projects individually. However, opening the parent folder as a project allows the 4 individual projects to see symbols in their sibling projects that are dependencies, so opening the parent (non-maven) directory as a project works well for me.

Once in a while, my .idea folder gets screwed up royally and I have to delete it and start over. This happens about once a year, so I'm ok with dealing with it when I have to. However, I find I have to run through the following ridiculous process to get all the red (missing symbol) marks out of my code:

  1. delete the .idea directory (because it was totally screwed up)
  2. open the root directory as a project
  3. get it to recognize the maven pom files and convert project to maven
  4. reimport/reload all maven imports
  5. ensure all source directories are actually marked source directories
  6. (at this point we're still seeing red all over the place, even though build from command line is clean)
  7. invalidate caches and restart

Finally the project seems to be back in working order again - why can't IntelliJ just figure out where my symbols are (within the maven projects that are under my project root)? Why do I have to do that last step - Invalidate caches and restart - just to get it to see symbols correctly?

Note that if I perform the above steps in a different order, it takes much more effort to get everything cleaned up. The ordered list above is the process I've discovered over the years that gets me back in running order the fastest.

Could it be that I'm not using IntellJ or loading my project in a manner that is not common among other developers and so it's a corner case JetBrains doesn't deal much with?

0
1 comment

Please report at https://youtrack.jetbrains.com/newIssue?project=IDEA with the sample project, logs (Help | Collect Logs and Diagnostic Data) and the steps to reproduce attached,

0

Please sign in to leave a comment.