javaeclipsegradlepackage-explorer

Eclipse Package Structure messed up when importing gradle project


usually when I start a project the structure in the package explorer is something like this:

src/main/java
  |- org.companyname.myproject
     |- repositories
     |  |- ClassA.java
     |  |- ClassB.java
     |- services
     |  |- userservice
     |  |  |- ClassC.java
     |  |- otherservice
     |  |  |- ClassD.java

so in the package explorer I can quickly expand and collapse all the relevant packages.

However recently when I import projects as a gradle project this structure is converted to:

src/main/java
  |- org.companyname.myproject.repositories
  |  |- ClassA.java
  |  |- ClassB.java
  |- org.companyname.myproject.services.userservice
  |  |- ClassC.java
  |- org.companyname.myproject.services.otherservice
  |  |- ClassD.java

I know this is only esthetically but for me it's so obnoxious and unreadable. Any tips on how to restore the original structure view?

If I remember correctly I didn't have this issue earlier when I imported gradle projects.

Thank you very much.


Solution

  • Your view package presentation setting needs to change. Just change it from flat to the hierarchical Package Presentation section shown below.