Skip to content

Large Maven workspaces trigger repeated MavenProject reconstruction during the initial workspace build #2229

Description

@shin19991207

Duplicate check

  • I have searched for existing issues/discussions and could not find a duplicate.

What problem does this solve?

During Maven import, M2E creates an expensive MavenProject for each Maven module and stores it in MavenProjectCache so later operations, such as builds, classpath configuration, launches, and editor features, etc., can reuse the model across Maven contexts.

MavenProjectCache has a default capacity of 50 cache lines. In large Maven workspaces (one example is the Quarkus repository, which contains approximately 1432 Maven projects), many imported MavenProject models can be evicted before the initial workspace-wide MavenBuilder pass needs them. Those cache misses force M2E to reconstruct models it had already created. When this happens across many projects, the repeated work can significantly increase the initial build and startup time.

This is related to #2167, which describes a problem caused by the same cache eviction/reload path, but this issue focuses on the performance impact during the import-to-initial-build transition.

Proposed solution

Keep the normal cache, but temporarily retain each imported MavenProject until its first relevant Maven build finishes.

Import creates MavenProject
        │
        ├── normal cache (max 50)
        └── temporary retention
                    │
                    ▼
              MavenBuilder
                    │
              cache lookup
              /          \
           HIT            MISS
            │              │
            │        retention lookup
            │              │
            │             HIT
            │              │
            │        restore to cache
            │              │
            └──────┬───────┘
                   ▼
            use MavenProject
                   │
                   ▼
       first relevant build finishes
                   │
                   ▼
          release retention

Was an AI/GenAI agent used to prepare this issue?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions