Skip to content

jdtls: pom.xml validation failure blocks file indexing; need explicit source path configuration #1

@zhanpengliu-tencent

Description

@zhanpengliu-tencent

Problem

When using jdtls to analyze Java projects, if pom.xml validation fails (e.g., "Non-resolvable parent POM"), jdtls fails to index the project's Java files. Basic operations like textDocument/documentSymbol stop working for files in the project.

This is common when analyzing arbitrary third-party projects where parent POMs are hosted on private/inaccessible registries.

Current workarounds and their limitations

  1. Lightweight/syntax mode (-Dsyntaxserver=true): Disables textDocument/references and other semantic features — not usable for reference finding.

  2. Disable Maven/Gradle import (java.import.maven.enabled: false): jdtls loses awareness of the multi-module project structure, so cross-module references don't work.

None of these options provide best-effort cross-module reference finding without requiring successful dependency resolution.

Proposed solution

Extract module structure directly from pom.xml / settings.gradle without invoking Maven/Gradle, then configure jdtls with explicit source paths:

  • Parse <modules> from pom.xml (Maven) or include from settings.gradle (Gradle)
  • Map each module to its conventional source directory (e.g., {module}/src/main/java)
  • Pass discovered paths via java.project.sourcePaths in initializationOptions
  • Disable Maven/Gradle import to avoid resolution errors

This gives jdtls full visibility into all source files across modules, enabling cross-module reference finding without any dependency resolution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions