Skip to content

v4 API/SPI gaps for build extensions — analysis from Tycho #13499

Open

Description

@gnodet

Context

As part of assessing the readiness of major Maven extensions to migrate to the Maven 4
API, we analyzed Tycho (build extension) and m2e (IDE embedder) — two projects
that together exercise nearly every Maven extension point: lifecycle participation,
dependency resolution, reactor graph, plugin realm management, classloading, and
embedded execution.

This issue tracks v4 API/SPI gaps not already fully covered by #13460 sub-issues.

Sub-issues

Already tracked elsewhere


Part 1 — Gaps identified from Tycho

Tycho is a build extension that replaces Maven's dependency resolution with P2/OSGi,
injects custom reactor graph edges, and bridges Maven's classloading with an embedded
Equinox runtime. It uses Maven 3 internals across ~400+ production source files.

1. Lifecycle Participation SPI → #13514

Tycho's TychoMavenLifecycleParticipant uses afterProjectsRead() to resolve the P2
target platform and inject dependencies into every MavenProject before any mojo
executes. TychoProjectExecutionListener uses beforeProjectLifecycleExecution() for
lazy per-project resolution with execution plan inspection.

The v4 Listener/Event mechanism is too generic — it lacks structured callbacks with
mutable project access. No equivalent of AbstractMavenLifecycleParticipant or
ProjectExecutionListener exists in org.apache.maven.api.spi.

2. Workspace Reader SPI → #13515

PR #13094 introduces org.apache.maven.api.spi.WorkspaceReader with findArtifact()
and findVersions(). However, Tycho's TychoWorkspaceReader implements
MavenWorkspaceReader which adds findModel(Artifact) — used to generate
synthetic POMs for P2 artifacts that have no Maven pom.xml.

3. Scoped SPI Discovery → #13516

Tycho's DefaultPluginRealmHelper uses BuildPluginManager.getPluginRealm(),
MavenPluginManager.getPluginDescriptor(), and PlexusContainer.lookupList() to
discover SPI extensions contributed by plugin dependencies. It switches thread context
classloaders to plugin ClassRealms for scoped lookups.

4. ClassRealm Abstraction → #13223

PlexusFrameworkConnectServiceFactory manages an embedded Equinox framework keyed by
ClassRealm. #13223 Layer 1 would solve the tycho-maven-plugin-as-extension-shim
problem; the embedded OSGi framework management needs stable classloader primitives.


Part 2 — Additional gaps identified from m2e

m2e is an IDE embedder that bootstraps the full Maven container, manages concurrent
sessions, executes filtered build plans, and reads plugin configuration for IDE project
setup. It uses Maven 3 internals across ~300+ production source files and overrides 8
Maven internal components to adapt Maven's single-shot build model to the IDE's mutable
workspace.

5. Partial/Filtered Lifecycle Execution → #13517

m2e computes the full lifecycle execution plan, filters it through lifecycle mapping
metadata, then executes surviving mojos one-by-one because there is no Maven API for
"run this filtered subset of the plan." It manually reimplements MojoExecutor's inner
loop with per-mojo dependency resolution and artifact state snapshot/restore.

6. Mojo Configuration Introspection → #13518

m2e project configurators read plugin parameter values without executing the mojo to
configure IDE projects. Uses MavenPluginManager.getConfiguredMojo() and
PluginParameterExpressionEvaluator — all internal APIs.

7. Cache Invalidation → #13519

m2e overrides 5 Maven cache components solely to add eviction/flushing for IDE
workspace mutability. Generalizing PR #13094's PluginRealmCache.invalidate() pattern
would eliminate all 5 overrides.

8. Repository Event SPI → #13520

m2e overrides RepositoryListener to index workspace repositories. A listener SPI for
repository events would eliminate this component override.

Cross-references

Gap Source Sub-issue Related
Lifecycle participation SPI Tycho + m2e #13514 #13464, #13462
Workspace reader findModel Tycho #13515 PR #13094
Scoped SPI discovery Tycho #13516 #13465, #13223
Partial lifecycle execution m2e #13517 #13472, #13464
Mojo config introspection m2e #13518 #13465
Cache invalidation m2e #13519 PR #13094
Repository event SPI m2e #13520 —
ClassRealm abstraction Tycho + m2e — #13223
Reactor graph SPI Tycho — #13463 (tracked)
LegacySupport Tycho + m2e — #13462 (tracked)
Maven embedding API m2e — #13472 (tracked)

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

Activity

  1. added
    tracking
    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

    tracking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions