Skip to content

JDTLS spawns separate process per module in Java Maven multi-module projects #28760

Closed

Description

@areyouok

Description

In a Maven multi-module project (parent pom.xml with <modules>), JDTLS spawns a separate process for each submodule instead of sharing a single instance at the topmost parent pom.xml.

For example, with this structure:

project-root/
  pom.xml              (parent, declares <modules>)
  module-a/pom.xml     (child module)
  module-b/pom.xml     (child module)

Opening Java files in module-a and module-b each starts a separate JDTLS process. Each JDTLS instance uses ~1GB, so a project with 5+ modules easily consumes 5GB+ of memory.

The existing fix (#14192) resolved this for Gradle monorepos by walking up to find settings.gradle. However, Maven multi-module projects were not addressed — the root detection still falls back to the nearest pom.xml for Maven projects.

Steps to reproduce

  1. Create a Maven multi-module project with a parent pom.xml and 3+ child modules
  2. Open Java files from different modules in opencode
  3. Observe multiple JDTLS processes via ps aux | grep jdtls

Operating System

macOS 26.4 (aarch64)

Activity

  1. github-actions commented on May 22, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of (or closely related to) an existing issue. Please check:

  2. changed the title [-]JDTLS spawns separate process per module in Maven multi-module projects[/-] [+]JDTLS spawns separate process per module in Java Maven multi-module projects[/+] on May 22, 2026
  3. areyouok commented on May 23, 2026

    @areyouok
    ContributorAuthor

    #11368 is not exactly the same as this issue. It's already closed, but the Java Maven multi-module scenario was not fixed. opencode spawns numerous JDTLS processes, making LSP nearly unusable for Java projects. The PR I submitted fixes this issue.

  4. scrumpypoker commented on Jun 7, 2026

    @scrumpypoker

    Confirmed, the Maven multi-module issue is still there. This screenshot can help you realise what the multi-module Maven situation with OpenCode is :-) Fixing this issue will really help a lot with development process for more complex repositories and will free gigabytes of RAM.

    Image
  5. areyouok commented on Jun 8, 2026

    @areyouok
    ContributorAuthor

    @scrumpypoker You can use my PR and build it yourself. I’ve been using it for days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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