-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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
-
Lightweight/syntax mode (
-Dsyntaxserver=true): DisablestextDocument/referencesand other semantic features — not usable for reference finding. -
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>frompom.xml(Maven) orincludefromsettings.gradle(Gradle) - Map each module to its conventional source directory (e.g.,
{module}/src/main/java) - Pass discovered paths via
java.project.sourcePathsininitializationOptions - 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.