Skip to content

Maven project 5 folders deap are not loaded as java projects #4364

Closed

Description

@youngm

Describe the bug
I have a repository with java projects spread throughout. Some 5 folders deep. I've noticed that my deep folder java projects aren't loaded. The "Maven" view shows the pom, but the "Java Projects" does not show the projects as loaded.

If I move the project one level up (4 levels deep) then the project is detected and loaded.

To Reproduce
Steps to reproduce the behavior:

  1. Load the attached sample project
  2. Notice Maven find the pom
  3. Notice the "Java project" is not loaded

testproject.zip

Expected behavior
I'd expect java projects 5 levels deep to be loaded.

Screenshots

Image

Environment

  • Operating System: Windows with project in WSL
  • JDK version: 25
  • Visual Studio Code version: 1.111.0
  • Java extension version: 1.53.0

Activity

  1. chagong commented on Jun 12, 2026

    @chagong
    Contributor

    This one's an off-by-one bug in the scanner JDTLS uses to auto-discover build files (BasicFileDetector).

    When java.import.projectSelection is automatic (the default), the server hunts for pom.xml files by walking your workspace with Files.walkFileTree(..., maxDepth, ...), and maxDepth is 5. The catch: the pom.xml check only happens in preVisitDirectory, but walkFileTree never actually opens the folders sitting exactly at maxDepth — those get handed off to visitFile instead. So a project folder exactly 5 levels deep just gets skipped, while 4 levels deep sails through. (The Maven view finds your pom on its own, which is why it still shows up there.)

    I grabbed your sample (1/2/3/4/test/pom.xml) and confirmed it: maxDepth=5 finds nothing, bump it to 6 and it shows up. The fix is to also check the folders that land on the depth boundary in visitFile. PR on the way.

  2. added a commit that references this issue on Jun 12, 2026
    73ea861
  3. added this to the End of May 2026 milestone on Jun 12, 2026
  4. added a commit that references this issue on Jun 15, 2026
    937c422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions