Skip to content

Feature Request: Add Maven Project Support #114

@oscarvarto

Description

@oscarvarto

Feature Request: Add Maven Project Support

Add Maven project import support to kotlin-lsp, enabling the Language Server to work with Maven-based Kotlin/Java projects in addition to the currently supported Gradle projects.

Currently, kotlin-lsp only supports Gradle JVM projects out-of-the-box (as noted in the README). Many JVM projects, use Maven as their build system.

Key Use Cases:

  • Enterprise projects with established Maven infrastructure
  • Mixed Java/Kotlin codebases using Maven
  • Java projects migrating to Kotlin incrementally
  • Projects that prefer Maven's declarative approach
  • Legacy Java codebases adding Kotlin support

Trying to fill a need (knowing the repo doesn't accept direct contributions now)

See oscarvarto@cf800ad

1. Leverages Existing IntelliJ APIs

  • Uses org.jetbrains.idea.maven.project.MavenProjectReader for POM parsing
  • Adapts patterns from IntelliJ's KotlinMavenImporter and KotlinMavenImporterEx
  • Ensures compatibility with IntelliJ Platform's Maven support

2. Follows GradleWorkspaceImporter Pattern

  • Same entity structure (ModuleEntity, LibraryEntity, KotlinSettingsEntity)
  • Same naming convention (.main and .test modules)
  • Same error handling approach (WorkspaceImportException)

3. Importer Order

Placed before GradleWorkspaceImporter because:

  • Some projects have both pom.xml and Gradle files
  • If Maven is present, it's typically the primary build system
  • Users can override with workspace.json if needed

4. Testing Approach

Follows existing test pattern:

  • Imports Maven project → converts to WorkspaceData
  • Compares with expected workspace.json
  • Validates round-trip conversion

Related Issues/PRs

This addresses the roadmap item from README.md:

* [ ] Project import
  * [x] Gradle JVM project import
  * [ ] Maven/Amper import  <-- This feature request

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