Eclipse showing java project src folder view as all packages and subpackages

12,662

Solution 1

Look at the 'Java Build Path' in the project 'Properties' and check that you have the correct 'Source' folders. It looks like you may have just 'src' as a source folder when you should have 'src/main/java', 'src/test/java'...

Solution 2

I was able to fix this by maven>update project, then just refresh...

Solution 3

In addition to the previous answer you also may use empty package filter: At the top-right of the Package Explorer view, there's a downward-pointing triangle. If you hover your mouse pointer over it you'll see View Menu.

Click the View Menu, select Filters, put a check next to Empty Packages, then click OK. Same way you could tune other options for Package explorer such as file types to show etc.

Share:
12,662
mosawi
Author by

mosawi

Updated on July 07, 2022

Comments

  • mosawi
    mosawi almost 2 years

    Not sure how to really ask this question since I don't know what everything is called but I'll try to do the best I can.

    So as I was cleaning up my classes. I right clicked my project and selected refresh. Then all of a sudden my project view changed, the src folder shows everything as packages and '.' separated subpackages. And all my code package declarations seems now to be undiscoverable.

    I've attached a photo, hopefully you can petter understand this...How can I fix this to have the correct directory view/structure.

    Edit:

    Here is what I have linked to my JAVA build path

    I don't understand what is happening? How can all of a sudden my project screw up like it has? Any help will be much appreciated

  • Jasper
    Jasper over 2 years
    I first had to do @mosawi's answer with the Maven>update project, and then I did the above steps