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): Disables textDocument/references and 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> 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.
Problem
When using jdtls to analyze Java projects, if
pom.xmlvalidation fails (e.g., "Non-resolvable parent POM"), jdtls fails to index the project's Java files. Basic operations liketextDocument/documentSymbolstop 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.gradlewithout invoking Maven/Gradle, then configure jdtls with explicit source paths:<modules>frompom.xml(Maven) orincludefromsettings.gradle(Gradle){module}/src/main/java)java.project.sourcePathsininitializationOptionsThis gives jdtls full visibility into all source files across modules, enabling cross-module reference finding without any dependency resolution.