Skip to content

Define v4 API for project dependency graph and migrate graph builder #13463

Open

Description

@gnodet

Part of #13460 — Migrate Maven internals from v3 to v4 API

Context

The project dependency graph / reactor concept has no v4 API equivalent today. The v3 ProjectDependencyGraph interface and its implementations (DefaultProjectDependencyGraph, FilteredProjectDependencyGraph) live in maven-core and operate entirely on MavenProject.

The DefaultGraphBuilder (~63 references to v3 types) builds the reactor by collecting projects, sorting them, and constructing the dependency graph — all using v3 types.

Goal

  1. Design a v4 API for the project graph (new interfaces in api/maven-api-core or api/maven-api-services)
  2. Implement the graph builder in impl/maven-impl using v4 Project and Session
  3. Wrap for v3 compatibility

Key files

  • v3 graph builder: impl/maven-core/.../graph/DefaultGraphBuilder.java
  • v3 graph: impl/maven-core/.../graph/DefaultProjectDependencyGraph.java
  • v3 filtered graph: impl/maven-core/.../graph/FilteredProjectDependencyGraph.java
  • Project selector: impl/maven-core/.../graph/ProjectSelector.java
  • Collection strategies: impl/maven-core/.../project/collector/ (MultiModule, Pomless, RequestPom)

API Design Considerations

  • Should the v4 graph be a service (GraphBuilder) or a type (ProjectGraph)?
  • How does it relate to the reactor concept?
  • Should project selection/filtering be part of the graph API or separate?
  • Consider exposing topological ordering and dependency queries

Dependencies

Complexity

Medium. ~5 key files to migrate, but requires API design decisions.

Claude Code on behalf of Guillaume Nodet

Activity

  1. added
    enhancement
    on Oct 13, 2026
  2. gnodet commented on Oct 14, 2026

    @gnodet
    ContributorAuthor

    Cross-referencing #13499 — from Tycho's perspective, a contributor/decorator pattern for the graph builder SPI would be preferable to requiring full graph builder replacement.

    Tycho's TychoGraphBuilder currently overrides DefaultGraphBuilder via @Priority, delegates to it first, then adds P2/OSGi-derived inter-project dependency edges. A SPI that lets extensions contribute additional edges to the reactor graph (rather than replacing the entire builder) would be cleaner and composable with other extensions.

    Claude Code on behalf of Guillaume Nodet

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions