Quite often, when I rename a maven module, IntellijIdea gets confused and keeps showing the old module name in the project view.
- Re-importing maven projects does not help.
- Clearing the IntellijIdea caches and restarting does not help.
- Even deleting the .idea directory does not help.
I discovered that this is happening because:
- IntellijIdea keeps information about a project outside of the .idea directory
- IntellijIdea fails to delete that information when you invalidate caches and restart.
The solution I have found to this problem is:
- Exit IntellijIdea.
- Go to the application data directory of IntellijIdea (on my Windows machine, this currently is %USERPROFILE%\AppData\Local\JetBrains\IdeaIC2022.1)
- Delete the `external_build_system` subdirectory
- Start IntellijIdea.
- Re-import all maven projects.
Shortly after I discovered this, a new release of IntelliJ IDEA came out, (IdeaIC2021.3) and there appears to be no "external_build_system" subdirectory in its directory. Miraculously, it makes use of the "external_build_system" subdirectory of the IdeaIC2021.1 directory!