0

I had a project with the structure com.foo.Class, I moved a bunch of classes from the package com.foo to different sub-packages com.foo.bar by dragging and dropping the files in the project explorer. I moved more than one file at a time.

After the initial refactor the classes in the new packages could not import classes from the other sub-packages (e.g com.foo.bar1.ClassA cant import com.foo.bar2.ClassB)

It is a Maven project and my initial package is in the main/java folder.

I proceeded to invalidate caches ticking all boxes in the dialog. Now IntelliJ doesn't even open my .java files and they appear with a different symbol than the files in the main package. I also tried right-clicking in the pom.xml and then Maven --> Reload project to no effect.

Top icon is the icon of regular classes, and the bottom icon is the one used for the classes I cannot open (it seems to match the icon used for package-info.java files)

The top icon is the icon of regular classes, and the bottom icon is the one used for the classes I cannot open (it seems to match the icon used for package-info.java files). New classes are created with the regular class icon and I can open them without any trouble.

One time after invalidating the caches some of the classes I moved appeared with the regular symbol and I could open them. However, after another cache invalidation, I can no longer open them. New classes can be added to the packages and are detected normally.

  • See https://stackoverflow.com/a/43319356/104891 and https://stackoverflow.com/a/13374653/104891. In a Maven project, all sources must be under `src/main/java`. – CrazyCoder May 10 '23 at 20:09
  • All my sources are under src/main/java , specifically under src/main/java/com/foo – Sergio Martin May 10 '23 at 20:15
  • Please provide the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). What icons do the .java files have? – CrazyCoder May 10 '23 at 20:26

1 Answers1

0

Managed to fix the problem, after invalidating caches, I went to the files per sub-package, right-click, and then reload from disk. Note that File --> Reload All from Disk did not work.