Skip to content

v4 API: Partial/filtered lifecycle execution for IDE embedders #13517

Open

Description

@gnodet

Parent: #13499 | Related: #13472, #13464

Problem

There is no Maven API for "execute a filtered subset of the lifecycle execution plan."
IDE embedders must reimplement the MojoExecutor inner loop mojo-by-mojo.

Who needs this

  • m2e: Computes the full lifecycle plan via LifecycleExecutor.calculateExecutionPlan(),
    filters it through lifecycle mapping metadata (classifying each mojo as
    execute/configurator/ignore/error), then executes surviving mojos in lifecycle order
    one at a time. Because there's no API for running a filtered plan, m2e manually:
    • Calls LifecycleExecutionPlanCalculator.setupMojoExecution() per mojo
    • Calls MojoExecutor.ensureDependenciesAreResolved() per mojo (redundant — should
      happen once at phase boundaries)
    • Snapshots/restores project artifact state around each mojo to prevent cascading
      side-effects (unnecessary if Maven ran the plan as a unit)

What's needed

A v4 API for executing a filtered subset of the lifecycle execution plan with proper
phase-boundary handling. Either:

// Option A: execute a filtered plan
session.executePartialPlan(project, List<MojoExecution> filteredPlan)

// Option B: predicate/filter on the lifecycle engine
session.executeLifecycle(project, mojoExecution -> filter.test(mojoExecution))

This lets Maven handle dependency resolution at proper phase boundaries, manage mojo
ordering and dependency contexts correctly, and eliminates the snapshot/restore hack.

This fits naturally as a feature of #13472 (v4 execution service) or #13464 (lifecycle
engine).

🤖 Drafted with Claude Code (Claude Opus 4.6, interactive mode). Reviewed and confirmed by @gnodet before submission.

Activity

  1. added
    enhancement
    on Oct 14, 2026
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