Skip to content

Measure the impact of porting Maven components and plugins to the Maven 4 APIΒ #13302

Open

Description

@slachiewicz

Description

An impact study, not a migration: on 2026-09-30 the Apache Maven components and plugins were ported from the Maven 3 API (MavenProject, org.apache.maven.artifact, maven-compat, Sisu and Plexus components) to the Maven 4 API at 4.0.0-rc-7, to measure what ports cleanly, where the Maven 4 API has no equivalent, and which components are better kept on Maven 3 than ported.

The study was closed as not planned on 2026-10-07: Maven 4.0.0 is not released, and a second line per component would double the maintenance. No port was merged. It was reopened on 2026-11-14 to keep the findings current: the ports were rebased, the gaps were rechecked, and what came out of it is tracked in #14000 and #14001. This description was revised on 2026-11-14 to say where each finding stands now, after the ports were rebased and run against a build of master.

How to read it:

Where the gaps stand

Closed on both branches

Gap at rc-7 Fixed by
PackagingProvider ignored by the packaging registry (#13306, reopened and still open) maven-4.0.x: #13550, the backport of #13319. master: #13319 was reverted by #13574 and redone in #13570, which also filters providers by class-loader visibility. Core IT gh-13306 on both branches
MojoExecution.getPlugin().getDependencies() throws when the plugin realm comes from the cache (#13307) #13312
Maven DI cannot inject an empty List or Map #13878, backport #13879

Closed on master only

Gap at rc-7 Fixed by Still missing
An XmlNode mojo parameter loses its XML attributes (#13305) #13636 replaced the Plexus configurator; the node is passed through unchanged (#13528) PlexusConfiguration parameters remain unsupported; XmlNode is the replacement
No conflict data on Node #13485: winner(), premanagedVersion(), premanagedScope(), originalScope() (#13151, still open) A parent link, a dependency trail (Maven 3 Artifact.getDependencyTrail(), now used by maven-dependency-analyzer) and the declared version constraint
No request data on Session: -ff/-fae/-fn, requested -P profiles, -pl, -rf, threads #13542: Session.buildInvocation() -e, and the settings and toolchains file locations

Partly closed, on master only

Gap at rc-7 What master has What is still missing
No plugin manager: nothing resolves, configures or runs another plugin's mojo, so a Maven 4 site plugin cannot run reports PluginManager.loadPlugin (#13625) returns a plugin's descriptor, dependencies and realm with a Lookup; LifecycleExecutor (#13612) plans and executes a project's lifecycle, with a filter A configured mojo instance that is not executed: a site plugin calls generate on the report, it does not run the goal. Tracked in #13518. loadPlugin accepts build plugins only, not the ones under <reporting>
No SPI to skip or replace a mojo execution, and no lifecycle participant ProjectTransformer (#13808) replaces afterProjectsRead; ExecutionListener, and Listener discovered as an SPI service (#13701); LifecycleProcessor; a static filter, maven.lifecycle.filter (#13392) A decision taken at execution time with access to the build state, which is what the build cache needs: #13987. Per-project callbacks: #13807
plugin-tools writes no <resolutions>, does not extract dependencyResolutionPathScopes, and fails on dependencyCollection Maven has its own descriptor generator, maven-plugin-mixin (#13644, #13658), an annotation processor that writes all three maven-plugin-tools, whose latest release is still 4.0.0-beta-3, has open issues with open fixes: apache/maven-plugin-tools#1230 (<resolutions>, fix in apache/maven-plugin-tools#1234), apache/maven-plugin-tools#1231 (dependencyCollection and path scopes, apache/maven-plugin-tools#1237), apache/maven-plugin-tools#1232 (@Execute with a custom phase, apache/maven-plugin-tools#1235). apache/maven-plugin-tools#1229 (constructor injection) is open
Legacy BuildContext forces org.eclipse.sisu.plexus at compile scope Nothing merged #12576 was closed; #13983 replaces it with an incremental build context, and apache/maven-filtering#363 is the experiment on it

Open, with a design issue

Gap Issue
No public Session outside a Maven runtime. ApiRunner is still internal to maven-impl, though it is now used and fixed as if it were public (#13655, #13469, #13835) #13472
A Maven 4 API mojo cannot inject a Sisu or Plexus component from its plugin realm (ScmManager, ArchiverManager, the Doxia managers, Wagon). loadV4Mojo still builds a standalone injector #13326 and its fix #13327 are closed. The direction is the opposite one: #13989 prepares build extensions for a Maven 5 without Sisu
Project has no resolved-artifact view and no project references #13460 puts resolved dependencies and attached artifacts on Project; #13463 defines the project graph
Mojo configuration cannot be read without running the mojo #13518
No forked-lifecycle API; @Execute(phase = "none") crashes the descriptor generator #13762 deprecates @Execute and aggregator in favour of @After and the after: phases; #13763 already maps aggregator in the concurrent builder; the migration guide is #13764
A plugin or extension cannot ask for a core package in its realm, or share types with another plugin #13223
No API to start a process; maven-shared-utils JavaTool reaches the toolchain by reflection and silently runs the Maven JDK on Maven 4 #13895
org.apache.maven.api.di.MojoExecutionScoped is unusable, and the mojo execution scope does not reach threads a plugin starts #13839, #13827

Open, no issue found

Rechecked in the code on both branches, unchanged. A search of the open issues and pull requests of apache/maven on 2026-11-14 found nothing that closes them; the rows name what is related. They are now collected in #14001, except the rows on Session.getProject, JavaPathType and DependencyCoordinatesFactory.

Gap Hit in
No settings encryption or decryption API for a plugin release, gpg, jarsigner
No original (pre-interpolation) model on Project release, enforcer
No metadata resolution service (master has a RepositoryMetadata type and repository events, but nothing resolves metadata); RemoteRepository has no policies; no artifact-descriptor service, so relocation is re-implemented archetype, resolver-ant-tasks, dependency, doap
Transport has no existence check doap
Session.getProject returns nothing for a project without a base directory, so Project.getParent() is empty for a parent from a repository and ProjectBuilder returns an empty result for a Source. This is also half of what blocks maven-project-info-reports-plugin. Related but not a fix: #13538, #13669 site, doap, invoker, project-info-reports
JavaPathType classifies each dependency alone; addOutputDirectory is still marked as not called. Related: #9065 jmod
Mojo expressions resolve objects under session., project., mojo. and settings. only: no ${plugin.*} surefire, scm-publish, changelog
ToolchainFactory is not a Service, so a plugin cannot inject one to turn a ToolchainModel into a Toolchain toolchains
DependencyCoordinatesFactory.create(Session, model.Dependency) drops scope, optional and exclusions; master has new overloads that take them, but this one is unchanged shade

Not rechecked

Stated at rc-7 and not looked at again; each needs a reproducer before it is acted on.

  • Resolution ignores includesDependencies of war, ear and rar, and lists an artifact reached by several paths only under its nearest parent (ear). Doubtful as worded: FatArtifactTraverser in maven-impl read that property at rc-7 already.
  • No timestamped snapshot version on a resolved artifact (ear).
  • Session.withLocalRepository cannot override the split local repository layout; no settings merge; no view of the plugin's own artifacts (invoker).
  • No remote-layout service (doap).
  • Resolved dependencies come level by level rather than in tree order (dependency).
  • No version resolution for plugins, report plugins and extensions (release). VersionResolver existed at rc-7 and takes any artifact coordinates, so what was missing is narrower than stated.
  • No way to configure conflict resolution or scope selection for a verbose collection (dependency-tree). DependencyResolverRequest.getVerbose() existed at rc-7.
  • A ToolchainFactory contributed by an extension is found only through the Sisu index (toolchains).
  • No factory for Dependency, Type or Version without a Session (dependency-tree, mapping, surefire).
  • Configuration cannot populate model types, and the strict reader rejects <reports> and plugin <goals> (surefire, archetype).
  • A plugin cannot replace the project's POM file (shade). [Backport master] Fix DefaultArtifactManager.getPath() to honor explicitly-set paths over project artifact fileΒ #13543 changed how an explicitly set artifact path is honoured; [MNG-8072] Add a consumerPomFile to the MavenProjectΒ #10863 asks for a consumerPomFile on the Maven 3 MavenProject; Maven 4 consumer and build-pom file conflictΒ maven-shade-plugin#864 is open for the conflict with the consumer POM, with a file-level fix in [#864] Fix Maven 4 shaded consumer POMΒ maven-shade-plugin#865.
  • A model without <name> gives a null name where Maven 3 fell back to the artifactId (site, doap). Two ports needed the fallback, so it is not only a doxia-sitetools matter.

Found while rebasing

Upstream changes made since October that the ports could not carry. Checked on maven-4.0.x and master on 2026-11-14; four are in #14001 and one is a bug, #14004.

Gap Where it stands
A custom DependencySelector for one resolution; DependencyResolverRequest takes a PathScope only (dependency) Holds on both, by design: the compile and test path scopes resolve conflicts over the whole graph before filtering scopes. In #14001
The source of a mojo execution: Maven 3 MojoExecution.getSource() (dependency) Holds on both. On master the Javadoc says executionId() is empty for a command line goal; the implementation returns default-cli. In #14001
Pattern filters that match the file extension as well as the type (dependency) Wrongly stated: Dependency has both. The extension is lost in maven-common-artifact-filters, whose resolve.Node hands out a model Dependency
The local path of a system-scope artifact (dependency) Wider than stated: DependencyResolver drops system-scope dependencies, and maven-compiler-plugin 4.0.0-beta-5 cannot compile against one. Bug #14004
Excluding a file from a project resource: Maven 3 Resource.addExclude (remote-resources) Holds on both: SourceRoot is read-only and cannot be replaced. In #14001
Whether a type is added to the class path: Maven 3 ArtifactHandler.isAddedToClasspath() (shade) Wrongly stated: Maven derives it as Type.getPathTypes().contains(JavaPathType.CLASSES)
Strict reading of a Maven 3 model (remote-resources) Holds on both: the strict reader rejects <reports> and <goals>, which model version 4.0.0 declares. In #14001

Withdrawn

These were listed as API gaps at rc-7 and should not have been.

Claim Correction
Session has no build start time ProtoSession.getStartTime() existed at rc-7, and Session extends ProtoSession
No public test fixtures maven-testing shipped ProjectStub, SessionMock, MojoExtension and @InjectMojo at rc-7. Defects found in it later are fixed (#13810 to #13813, #13928)
No ArtifactHandler equivalent Type carries the id, language, extension, classifier, includesDependencies and path types. What disappeared are the reflective file-name tokens of maven-mapping, which is a property of that library
The mojo-descriptor model lacks threadSafe, instantiationStrategy, executionStrategy, requiresReports and requirements They are in plugin.mdo, for descriptor versions 1.0.0 and 1.1.0; version 2.0.0 does not have them. The consequence is narrower than stated: maven-plugin-tools cannot use the API model as its internal model for Maven 3 descriptors
Model builders do not clear a value set to null How the generated builders work: null keeps the value of the base object; Model.newBuilder(model, true) or withParent(null) clears it. A trap, not a gap
A bare @Named is the empty key, not default A difference from Sisu to document for plugin authors, not a defect
Session.resolveArtifact no longer fetches the POM or follows relocation It is a shortcut for ArtifactResolver.resolve. The Maven 3 code read the artifact descriptor, and the gap is the missing descriptor service, listed above
No path from Session or Project to MavenProject or RepositorySystemSession #13460 keeps the Maven 3 types for Maven 3 plugins as wrappers; a Maven 4 mojo is not meant to get them

From 4.0 to 4.2

The rebased ports, built against rc-7, were run on a build of master (6145dae) and then compiled against its API. On the master runtime they behave as on rc-7: 32 of 38 are green on both, with the same unit-test counts. Compiled against the 4.2.0-SNAPSHOT API, 14 of 31 are green and 13 fail because of an API change. Integration tests were then run for four ports. Built for 4.0, the antrun and checkstyle ports fail on master with NoSuchMethodError on MojoExecution.getConfiguration() (#14000). The antrun port compiled against 4.2 without its XmlNode workaround passes all 29 ITs on master, and 6 of 29 on rc-7, so #13636 fixes the attribute loss in a real plugin. The acr and rar ports do not use PackagingProvider, so their ITs say nothing about #13306.

Change on master Effect on code built for 4.0 Ports affected
MojoExecution has plugin(), configuration(), goal() and so on; maven-4.0.x has only getPlugin(), getConfiguration(), getGoal(). Neither line has the other's names Does not compile, and a plugin built for 4.0 fails on 4.2 with NoSuchMethodError: #14000 antrun, checkstyle, ear, enforcer, reporting-impl
The noun-style accessors of Artifact, Dependency, Project are abstract, with the get names as deprecated defaults (#13036, #13830) Callers compile with warnings; every implementation outside Maven stops compiling test stubs in mapping, common-artifact-filters, plugin-tools, release, sitetools; main code in dependency-analyzer
org.apache.maven.api.services.model.PathTranslator is gone from the SPI maven-plugin-testing-harness 4.0.0-beta-4 fails with NoClassDefFoundError changes, changelog
The org.apache.maven.api.di.testing and org.apache.maven.api.plugin.testing packages are gone from maven-testing Tests do not compile shared-jar
ModelResolver.ModelResolverRequest constructor changed Does not compile resolver-ant-tasks

The deprecated accessors most used by the ports are Artifact.getGroupId() and Project.getBasedir() (13 ports each) and Project.getModel() and Project.getVersion() (12 each).

In estate tooling and libraries

Gap State on 2026-11-14
ScmManager, the Doxia parser managers and a CompilerManager can be built only through Sisu The ServiceLoader factories were dropped (apache/maven-scm#1418, apache/maven-doxia#1110, codehaus-plexus/plexus-compiler#524) because #13326 was to make them unnecessary. #13326 is closed, so the question is open again; see #13989. For Doxia, apache/maven-doxia-sitetools#736 proposes passing parsers their context instead of injecting Maven objects
plexus-archiver archivers created without a container fail when unpacking codehaus-plexus/plexus-archiver#500 is merged on its master (5.0.0-SNAPSHOT); 4.15.0 does not contain it
plexus-velocity VelocityComponent in maven-archetype apache/maven-archetype#1044, merged
Report mojos: maven-site-plugin 3.x accepts only Maven 3 mojos as reports, and plugin-tools writes <requirements> inherited from AbstractMavenReport into a 2.0.0 descriptor, which Maven rejects for every goal of the plugin Unchanged. Reporting still has to move as a chain, and the chain waits for #13518
<proc>none</proc> in the parent POMs: the Maven DI index is written by hand Not rechecked
Dependency-reduced POM of a shaded build rejected by Maven 4 apache/maven-shade-plugin#813, closed as completed
spotless-maven-plugin @Component warning on Maven 4 diffplug/spotless#3122, released in 3.10.4

Findings, revised

  • Timing. Migrate Maven internals from v3 to v4 API (tracking issue)Β #13460 keeps MavenProject, MavenSession, AbstractMojo and the Maven 3 model as supported wrappers until Maven 5. A Maven 3 API plugin keeps working on Maven 4, so a port buys a plugin nothing until it needs something only the Maven 4 API offers.
  • Branch. Most of what closed since rc-7 closed on master only, so a port against 4.0.x re-implements what 4.2 provides. But a port built for 4.0 does not carry over: 13 of the 31 ports that could be compiled against the 4.2 API fail on an API change, and MojoExecution has no accessor name common to both lines (MojoExecution accessors differ between maven-4.0.x and master, so a plugin built for 4.0 fails on 4.2 with NoSuchMethodErrorΒ #14000).
  • Carrying cost. Six weeks after the last rebase every port branch was behind its default branch, by 6 to 109 commits, and a plain rebase conflicted in 44 of 50. Three ports (dependency, shade, remote-resources) could be brought forward only by porting upstream's changes one commit at a time; in maven-dependency-plugin that meant 76 commits touching ported files, and 405 upstream tests on the Maven 3 harness are now excluded, up from 265. The breakage came mostly from upstream's new tests, which are written against MavenProject stubs and merge without conflict, then fail to compile; in maven-archetype a merge without conflict brought back a bug that upstream had fixed in a method the port had rewritten.
  • Port order. The ports depend on each other through unreleased snapshots: maven-common-artifact-filters blocks javadoc, surefire and assembly, and the reporting ports block invoker and changelog.
  • Compatibility. A ported mojo still cannot run on Maven 3: the Mojo contract and the injector differ. The reverse works for single services: [maven-3.10.x] Replace the 3.10 MessageBuilderFactory with the Maven 4 APIΒ #13919 put the Maven 4 MessageBuilderFactory into maven-3.10.x, so one plugin binary injects it on 3.10 and 4 (Make the Maven 4 MessageBuilderFactory available in Maven 3.9 and 3.10Β #13917; no 3.9 backport is merged). That is cheaper than a second line per plugin.
  • Reporting. Still the largest blocker. doxia-sitetools, maven-site-plugin, reporting-impl and reporting-exec must move together, and the site plugin needs a configured report instance (v4 API: Mojo configuration introspection without executionΒ #13518). Until then every report goal stays on the Maven 3 API; the non-report goals of the same plugins ported.
  • Sisu libraries. maven-scm, plexus-archiver, Doxia and Wagon are Sisu components. With Maven 4 API mojos cannot inject Sisu components from their plugin realmΒ #13326 closed and Support pure maven-di build extensions (pave the way for Maven 5)Β #13989 open, a port either waits for those libraries or builds their components by hand, as the maven-scm-publish-plugin port did.
  • Redesigns. A port is rarely a type swap. The immutable model forced redesigns (maven-release edits the POM as a DOM), and three enforcer rules were removed rather than silently weakened: requireUpperBoundDeps, banDynamicVersions and requireProfileIdsExist. On master the first has the pre-managed version it lacked and the third has buildInvocation().activeProfiles(); banDynamicVersions still has no declared version constraint on Node. None was re-tried.
  • Scope. Not every component should adopt Maven DI. indexer-core is used outside Maven; dropping its Maven dependency serves it better than a port.
  • Tests. Green tests do not prove a port. A @Resolution field that stayed null passed every maven-rar-plugin test until an IT with real dependencies was added, and maven-shade-plugin stayed green while publishing the original POM instead of the reduced one.
  • Maven 3 lines. What landed is Simplifications for the 3.x linesΒ #13309: 33 changes on the 3.x lines (23 bugs and cleanups, 10 deprecations and seams). A second pass over the port diffs on 2026-11-14 found little left that is independent of the Maven 4 API: four code changes and one set of integration tests, listed below. No JUnit 4 or maven-compat use remains to remove on the default branches of these repositories, apart from maven-surefire, where JUnit 4 is the product.

Filed from this work

Item Outcome
#13305 XmlNode parameters lose attributes closed as not planned; fixed on master by #13636
#13306 PackagingProvider ignored fixed on both branches; issue still open
#13307 plugin dependencies throw on a cached realm closed as not planned; fixed on both branches by #13312
#13326 Sisu components in Maven 4 API mojos closed with #13327 and #13328: the fix was proven only with a test-side import of javax.inject
#13309 simplifications for the 3.x lines done, 33 changes; apache/maven-toolchains-plugin#196 was the last
#12709 minimum Maven baseline closed as not planned; #13748 (raise the plugin prerequisite to Maven 3.9.0) is closed as completed
apache/maven-plugin-tools#1229 mojo constructor injection open
apache/maven-doxia#1111 MarkdownHtmlParser registered through a bare @Named closed
apache/maven-shared-resources#87, apache/maven-archiver#416, apache/maven-filtering#411, apache/maven-archetype#1044 merged
#13895 process execution service, #13917 Maven 4 MessageBuilderFactory on Maven 3, #13827 mojo execution scope and plugin threads opened later from the same line of work; open
#14000 MojoExecution accessors differ between maven-4.0.x and master open
#14001 Maven 4 API gaps for plugin authors without an issue open
#14004 DependencyResolver drops system-scope dependencies open
#14007 master's V4MojoConfigurator never assigns an object to a non-scalar parameter open
#14010 version range resolution reports a failed metadata download as "No versions matched" open
apache/maven-jlink-plugin#710 (call ToolchainManager.getToolchains directly), apache/maven-remote-resources-plugin#352 and apache/maven-help-plugin#462 (plexus-utils helpers replaced by JDK calls), apache/maven-dependency-plugin#1800 (inject the analyzers instead of the Plexus container), apache/maven-changes-plugin#692 (integration tests for goals that had none) merged

Components

Results at rc-7 on 2026-09-30. After the rebase of 2026-11-14 the unit tests of 38 ports were run again on rc-7 and 32 are green; integration tests were not run again. Not green: assembly (needs snapshots of maven-archiver, maven-filtering and plexus-archiver that no longer exist), indexer, executor and checkstyle (do not build after the rebase), changelog (19 errors, as at rc-7), scm (one test). The javadoc, shade, remote-resources and dependency ports were not in that run; they were brought up to date afterwards and their unit tests pass. Counts are src/main files importing the Maven 3 API on the default branch at that date, excluding a plugin's own org.apache.maven.plugins.* packages; for the shared components the count is imports. For repositories that hold both a library and a plugin (surefire, release, enforcer, plugin-tools, archetype, scm, jxr, wrapper), only the library modules were counted and ported.

Uses the Maven 3 API of which ported partial blocked Uses no Maven API Already on the Maven 4 API
45 22 19 4 16 12

Uses the Maven 3 API

Component Maven 3 API use Study PR Result at rc-7
maven-acr-plugin 1 ported, green locally (4 ITs); app-client packaging still registered through a Sisu LifecycleMapping provider: rc-7 ignores PackagingProvider
maven-antrun-plugin 7 ported, green locally (4 unit, 29 ITs); Ant reference maven.project is now the v4 Project, maven.project.helper removed
maven-archetype archetype-common 11 partial: archetype-common ported; archetype plugin excluded, does not compile; remote catalog loses cache and update policy
maven-artifact-plugin 11 partial: 25 unit tests; ITs 13 β†’ 12 passed (buildinfo-dir: a pom project has no main artifact); check-buildplan approximated with no execution-plan service; reproducible-central report blocked by the reporting chain
maven-assembly-plugin 21 ported, green locally (271 unit, 156 ITs; the one failing IT is excluded from run-its by the POM); needs an unreleased plexus-archiver: its archivers cannot unpack without a container
maven-build-cache-extension 31 apache/maven-build-cache-extension#544, closed blocked: no SPI to skip or replace a mojo execution (now #13987); no code change
maven-changelog-plugin 3 blocked: compiles, but maven-site-plugin 3.x cannot run a v4 report mojo (Cannot cast ChangeLogReportFactory to org.apache.maven.plugin.Mojo); ITs 4 of 4 β†’ 0 of 4
maven-changes-plugin 28 partial: the four non-report goals ported (54 unit tests, 16 ITs incl. 11 new); report goals excluded
maven-checkstyle-plugin 8 partial: check ported (16 unit, 30 ITs; 4 ITs no longer run the report first); report goals blocked, 19 report ITs excluded; plexus-resources built without Sisu
maven-common-artifact-filters 16 apache/maven-common-artifact-filters#130, closed ported, one feature removed (actTransitively)
maven-dependency-analyzer 14 apache/maven-dependency-analyzer#305, closed ported
maven-dependency-plugin 75 partial: 25 of 29 goals ported (174 unit tests; about 265 Maven 3 harness tests excluded, not deleted); add, remove, list-repositories, analyze-report have no route; tree -Dverbose loses conflict data
maven-dependency-tree 12 apache/maven-dependency-tree#149, closed ported, verbose detail reduced; retirement proposed in apache/maven-dependency-tree#150, closed as not planned
maven-doap-plugin 3 ported, green locally (15 unit, 4 ITs); five behavioural approximations: repository policies, metadata, existence checks
maven-doxia-sitetools 5 (integration-tools, site-renderer) apache/maven-doxia-sitetools#701, closed ported; usable only at Maven 4 runtime
maven-ear-plugin 20 partial: 49 unit tests, 103 EarMojoIT cases and 17 of 18 ITs pass; skinny-wars-timestamp fails (no timestamped snapshot version); includesDependencies ignored by the resolver
maven-ejb-plugin 1 ported, green locally (36 unit, 9 ITs); needs sisu.plexus at compile scope for the legacy BuildContext, as maven-resources-plugin does
maven-enforcer enforcer-rules 38, enforcer-api 2, enforcer-extension 1 partial: api and rules ported (347 tests, 0 failures); 3 rules removed for lack of API (requireUpperBoundDeps, banDynamicVersions, requireProfileIdsExist); plugin and extension excluded
maven-gpg-plugin 9 partial: green locally (13 ITs + 4 Bouncy Castle ITs; gpg signer ITs not runnable here); encrypted {...} passphrases have no API route and now fail explicitly
maven-help-plugin 12 ported, green locally (61 unit, 36 ITs); describe prefix lookup and evaluate rebuilt without a plugin manager or expression evaluator; effective-pom properties now sorted
maven-indexer indexer-core 3 partial: indexer-core ported (model only); indexer-cli and search-backend-indexer still wired through Sisu and fail at runtime
maven-invoker-plugin 18 partial: 67 unit tests; 70 of 71 ITs run pass (22 not run); MINVOKER-377 fails because an alternate local repository cannot override the split layout; report goal blocked by the reporting chain
maven-jarsigner-plugin 3 ported, green locally (52 unit, 9 ITs); settings decryption rebuilt from plexus-sec-dispatcher internals
maven-javadoc-plugin 24 partial: every goal runs directly (75 unit tests; ITs 79 β†’ 75 passed, the 4 new failures are mvn site runs); as a site report blocked by the reporting chain
maven-jdeprscan-plugin 5 ported, green locally (6 unit, 6 ITs)
maven-jdeps-plugin 3 ported, green locally (11 unit, 7 ITs); @Resolution fields stay null because plugin-tools writes no <resolutions>
maven-jlink-plugin 5 ported, green locally (17 unit, 28 ITs); module path now from DependencyResolver, LocationManager dropped
maven-jmod-plugin 5 ported, green locally (18 ITs); main-module-aware module path still from plexus-java LocationManager
maven-mapping 1 apache/maven-mapping#77, closed ported; reflective file-name tokens lost
maven-plugin-tools tools-api 13, annotations 4, generators 3 partial: all but the descriptor model ported; maven-plugin-plugin and plugin-report excluded, do not compile
maven-pmd-plugin 26 partial: check goals ported (20 unit, 5 new ITs); report goals blocked; check depended on the report only through @Execute, now removed
maven-project-info-reports-plugin 26 blocked: every goal is a report; ProjectBuilder cannot build a project from a repository artifact, and conflict data exists only as text
maven-rar-plugin 4 ported, green locally (4 ITs, one new covering dependencies); rar packaging still registered through Maven 3 components
maven-release release-manager 59, release-api 7, oddeven-policy 1 partial: libraries ported (791 tests, 0 failures); immutable model forced a DOM-editing redesign; maven-release-plugin excluded, does not compile
maven-remote-resources-plugin 8 ported, green locally (11 unit, 9 + 7 ITs); supplemental-model merging reduced; a project resource can no longer exclude a bundle resource
maven-reporting-exec 21 apache/maven-reporting-exec#167, closed partial: public API ported, implementation stays on maven-core; ITs 5 of 5 β†’ 0 of 5
maven-reporting-impl 8 apache/maven-reporting-impl#254, closed blocked: compiles but cannot render; ITs 6 of 6 β†’ 1 of 6
maven-resolver-ant-tasks 10 partial: model and settings ported; relies on internal ApiRunner for a Session outside Maven
maven-scm-publish-plugin 2 ported, green locally (5 ITs); ScmManager built from the Sisu index by hand, maven-scm has no non-Sisu factory
maven-scripting-plugin 4 ported, green locally (5 ITs); script binding project is now the v4 Project
maven-shade-plugin 10 partial: green locally (72 unit, 85 ITs), but the dependency-reduced POM can no longer become the published POM (the original is installed); transformer SPI unchanged, Shader SPI changes
maven-shared-jar 4 apache/maven-shared-jar#182, closed ported
maven-site-plugin 24 partial: 10 goals run (deploy, stage, effective-site, attach-descriptor fully; site, jar, run without reports); 40 of 62 ITs, the other 22 lose report pages; reports need a plugin-manager API
maven-surefire maven-surefire-common 8; the forked-JVM modules use none partial: maven-surefire-common ported; it holds the mojo base class, so surefire and failsafe plugins cannot move separately
maven-toolchains-plugin 9 ported, green locally (8 ITs); an extension's toolchain factory is found only through the Sisu index

Uses no Maven API

16 components

These use no import from Maven core, model, plugin or artifact packages and no org.apache.maven:* dependency (Doxia is not Maven API). They work on Maven 4 as they are; there is nothing to port.

Component Study PR Result at rc-7
maven-archetypes green locally, 18 archetype builds; only archetype templates use the Maven API
maven-doxia apache/maven-doxia#1109 CI-only PR closed unmerged
maven-doxia-converter apache/maven-doxia-converter#165 CI-only PR closed unmerged
maven-executor green locally, 62 tests
maven-file-management apache/maven-file-management#119 CI-only PR closed unmerged
maven-fluido-skin apache/maven-fluido-skin#351 CI-only PR closed unmerged
maven-invoker apache/maven-invoker#189 CI-only PR closed unmerged
maven-jarsigner apache/maven-jarsigner#117 CI-only PR closed unmerged
maven-jxr only maven-jxr-plugin uses the Maven API (34 tests green on Maven 4)
maven-reporting-api apache/maven-reporting-api#88 CI-only PR closed unmerged
maven-scm green locally, 340 tests; only maven-scm-plugin uses the Maven API
maven-script-interpreter apache/maven-script-interpreter#223 CI-only PR closed unmerged
maven-shared-resources apache/maven-shared-resources#89 CI-only PR closed unmerged
maven-shared-utils apache/maven-shared-utils#442 CI-only PR closed unmerged
maven-wagon green locally, 1035 tests
maven-wrapper green locally, 34 tests; only maven-wrapper-plugin uses the Maven API

Already on the Maven 4 API

12 components
  • maven-archiver and maven-filtering
  • maven-xinclude-extension
  • maven-mvnd (maven.version is now 4.0.0-rc-7)
  • maven-clean-plugin, maven-compiler-plugin, maven-deploy-plugin, maven-install-plugin, maven-jar-plugin, maven-resources-plugin and maven-source-plugin on master, each with a -3.x maintenance branch
  • maven-war-plugin on its 4.0.x branch (master is 3.x)

The 2022 mvn4 prototype branches, written against an earlier API, were deleted (61 branches).

Out of scope at the time: maven (core), maven-integration-testing and maven-resolver (core or below it); maven-verifier (superseded by maven-executor); maven-shared-incremental and maven-shared-io (retired); maven-doxia-linkcheck and maven-default-skin (archived); maven-plugin-testing (its master was empty); parent POMs, maven-apache-resources, maven-gh-actions-shared, maven-site, maven-sources and maven-dist-tool (no library code).

Activity

  1. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  2. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  3. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  4. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  5. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  6. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  7. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  8. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  9. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    Author
  10. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    maven-shared-jar

    PR: apache/maven-shared-jar#182. Status: ported, 4.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 91 tests before and after, 0 failures; spotless clean.

    Public API changes

    • RepositoryHashSearch.searchFileHash/searchBytecodeHash (and EmptyRepositoryHashSearch): List<org.apache.maven.artifact.Artifact> β†’ List<org.apache.maven.api.Artifact>.
    • EmbeddedMavenModelExposer gains an injected ModelXmlFactory and reads the POM into the immutable v4 Model.
    • @Named/@Singleton/@Inject move from javax.inject to org.apache.maven.api.di, so Sisu no longer discovers these components; they cannot be injected under Maven 3.
    • JarAnalyzer, JarData, JarClasses*, JarIdentification* unchanged.

    Gaps

    • maven-shared-components parent sets <proc>none</proc>, so the maven-api-di index processor never runs; META-INF/maven/org.apache.maven.api.di.Inject is maintained by hand (as maven-filtering does). A new @Named class missing from it fails with "No binding".
    • ModelXmlFactory is implemented only in maven-impl, so the model exposer needs a Maven 4 container; the v4 MavenStaxReader lives in maven-support, which is not API.

    Consumers that break: maven-project-info-reports-plugin (DependenciesReport injects JarClassesAnalysis; Dependencies, DependenciesRenderer use unchanged types). It compiles, but under Maven 3 the component is no longer found.

    Improvements: drops javax.inject, sisu-maven-plugin, plexus-xml, maven-model, maven-artifact.

    Recommendation: port for Maven 4 plugins; keep a 3.x line while project-info-reports runs on Maven 3.

  11. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    maven-mapping

    PR: apache/maven-mapping#77. Status: ported, 4.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 8 tests before, 10 after (new: timestamped SNAPSHOT baseVersion, non-jar extension), 0 failures; spotless clean.

    Public API change: MappingUtils.evaluateFileNameMapping(String, org.apache.maven.artifact.Artifact) β†’ (String, org.apache.maven.api.Artifact). Dependencies drop to maven-api-core only.

    Gaps: tokens that no longer resolve

    • The v4 Artifact has no ArtifactHandler: @{packaging}@, @{language}@, @{directory}@, @{addedToClasspath}@, @{includesDependencies}@ are gone. @{extension}@ now comes from Artifact.getExtension().
    • No counterpart for the reflective @{type}@, @{scope}@, @{file}@. The path is available only via ArtifactManager or DownloadedArtifact.
    • No plugin source or site doc in the estate uses the removed tokens; user POMs are unknown.
    • Tests use a record stub because Session.createArtifact needs an InternalSession, so no public test fixture exists for a v4 Artifact.

    Consumers that break (compile): maven-war-plugin AbstractWarPackagingTask; maven-ear-plugin EarMojo, AbstractEarModule. Both must move to the v4 Artifact together.

    Recommendation: port; small change and every commonly used token keeps a source. Keep 3.x for the Maven 3 lines of war and ear.

  12. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    maven-reporting-exec

    PR: apache/maven-reporting-exec#167. Status: partial, 3.0.0-SNAPSHOT, Java 17. Public API ported; implementation stays on maven-core.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 4 unit tests, 0 failures; ITs 0 of 5 pass (5 before). Every IT runs the released maven-site-plugin 3.22.0 against this snapshot and fails with NoSuchMethodError: MavenReportExecutorRequest.setMavenSession(MavenSession). Spotless clean.

    Public API changes

    • MavenReportExecutorRequest: get/setMavenSession(MavenSession) β†’ get/setSession(org.apache.maven.api.Session); get/setProject(MavenProject) β†’ org.apache.maven.api.Project; setReportPlugins(org.apache.maven.model.ReportPlugin[]) β†’ org.apache.maven.api.model.ReportPlugin[].
    • MavenReportExecution: Plugin β†’ org.apache.maven.api.model.Plugin.
    • MavenReportExecutor.buildMavenReports throws unchecked MojoException instead of checked MojoExecutionException.

    Gaps: the v4 API has no equivalent for what this component does

    • MavenPluginManager, PluginDescriptor, MojoDescriptor, MojoExecution, PluginVersionResolver, plugin realm setup, and LifecycleExecutor.calculateForkedExecutions/executeForkedExecutions. DefaultMavenReportExecutor and MavenPluginManagerHelper therefore stay on maven-core.
    • Session β†’ MavenSession and Project β†’ MavenProject only via internal classes (InternalMavenSession.from(...), DefaultProject.getProject()).
    • MavenProject.isExecutionRoot() has no equivalent; Project.isRootProject() means the .mvn directory. This affects canAggregate.
    • Tests stay on @PlexusTest, since maven-testing targets v4-DI mojos. They need maven-compat for ToolchainManager and plexus-xml 4.2.0, because parent 50 manages 3.0.1, which fails with NoClassDefFoundError: Xpp3Dom$ChildrenTracking on Maven 4.

    Consumers that break: maven-site-plugin only (AbstractSiteRenderingMojo, AutoRefreshMojo, SiteMojo, SiteJarMojo, SiteRunMojo, ReportDocumentRenderer); shown at runtime by the ITs above.

    Recommendation: keep a 3.x line; this port is a facade only. A real Maven 4 version needs a report-execution or plugin-manager API in org.apache.maven.api. If the Maven 4 site plugin gets one, retire this component in its favour.

  13. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    maven-common-artifact-filters

    PR: apache/maven-common-artifact-filters#130. Status: ported, one feature removed, 4.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 231 tests before, 226 after, 0 failures. Six tests covered the removed actTransitively; one is new. Spotless clean.

    Public API changes

    • ArtifactFilter β†’ Predicate<org.apache.maven.api.Dependency> in Pattern{In,Ex}cludesArtifactFilter, Strict*, ScopeArtifactFilter and ArtifactIncludeFilterTransformer.
    • collection.* filters work on Set<Dependency> instead of Set<Artifact>.
    • Pattern{In,Ex}cludesArtifactFilter(Collection, boolean actTransitively) removed.
    • ArtifactTransitivityFilter(Artifact, ProjectBuildingRequest, ProjectBuilder) β†’ (Session, Artifact), collecting via TEST_RUNTIME; this approximates the old project-build resolution.
    • resolve.Node.getDependency() returns the immutable org.apache.maven.api.model.Dependency.
    • The EclipseAether* transformers stay on the resolver API; nothing in org.apache.maven.api models exclusions on a DependencyFilter.

    Gaps

    • No dependency trail or parent link on Artifact, Dependency or Node, so actTransitively is removed. This is the largest loss; maven-assembly-plugin useTransitiveFiltering depends on it.
    • Version ranges: VersionParser is only reachable through a Session, and filters are built without one; the port uses resolver-util GenericVersionScheme.
    • type, scope and optional live only on Dependency, so every filter moves from Artifact to Dependency.
    • No public factory for Dependency, Type or Version without a Session; tests and consumers need stubs or Mockito.
    • The new scopes (COMPILE_ONLY, TEST_ONLY, TEST_RUNTIME) have no defined behaviour in ScopeArtifactFilter; they are included, like unknown scopes before.

    Consumers that break (compile): maven-dependency-plugin, maven-assembly-plugin, maven-javadoc-plugin (ResourceResolver), maven-project-info-reports-plugin, maven-remote-resources-plugin, maven-surefire-common.

    Recommendation: port for 4.0.0 alongside a 3.x line, once a parent-aware replacement for actTransitively is agreed.

  14. 10 remaining items

  15. changed the title [-]Port the shared components to the Maven 4 API[/-] [+]Measure the impact of porting Maven components and plugins to the Maven 4 API[/+] on Sep 30, 2026
  16. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Wave 3 findings

    maven-build-cache-extension has its own comment above. Each port is a local branch agent/mvn4-api; the PRs are not opened yet.

    Migration not needed

    No Maven API in the library modules, so only CI changes (branch agent/mvn4-api, one commit "Build with Maven 4 only"; PRs not opened yet). Verified locally with mvn verify, Maven 4.0.0-rc-7, JDK 21:

    • maven-jxr: 34 tests, 0 failures (only maven-jxr-plugin uses the Maven API). Completed: migration not needed.
    • maven-wrapper: 34 tests, 0 failures (only maven-wrapper-plugin uses the Maven API).
    • maven-archetypes: 18 archetype builds, 0 failures (only the archetype templates use the Maven API).
    • maven-wagon: 1035 tests, 0 failures, 10 skipped.
    • maven-executor: 62 tests, 0 failures, 4 skipped.
    • maven-scm: 340 tests, 0 failures, 3 skipped (only maven-scm-plugin uses the Maven API).

    Ported libraries

    maven-surefire: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-SNAPSHOT, Java 17 (maven-surefire-common only).

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ before: 1487 tests in 12 modules, 0 failures (maven-surefire-common 867); after: maven-surefire-common 868 (865 with E2ETest excluded, 0 failures), other library modules unchanged. E2ETest.endToEndTest times out under machine load on the unmodified tree too (36 s against 30 s). maven-surefire-plugin, maven-failsafe-plugin and surefire-its are out of the reactor, so their 35 unit tests and all ITs did not run after. Spotless and RAT clean.

    Only maven-surefire-common uses the Maven API. surefire-booter, -api, -extensions-api, -logger-api, -report-parser and the providers import none; they run in the forked test JVM, stay on release 8, and need no port.

    Public API changes (maven-surefire-common)

    • AbstractSurefireMojo implements org.apache.maven.api.plugin.Mojo; getSession(), getProject(), getToolchainManager() return v4 types; MojoFailureException/MojoExecutionException both become the unchecked MojoException.
    • getPluginDescriptor() removed; getPluginArtifactMap()/getProjectArtifactMap() return v4 artifacts, computed lazily.
    • SurefireDependencyResolver takes a Session; isWithinVersionSpec is no longer static.
    • Parameter additionalClasspathDependencies becomes List<AdditionalClasspathDependency>, a new bean with the same XML, because the immutable v4 model cannot be populated from configuration.
    • DI moves to org.apache.maven.api.di; Sisu no longer discovers ProviderDetector or SurefireDependencyResolver.

    Gaps

    • The library holds the mojo base class, so SurefireMojo and IntegrationTestMojo cannot stay on Maven 3 while it moves: library and plugins must be ported together.
    • No MavenExecutionRequest in the API: -e and -ff/-fae/-fn no longer reach the forked JVM.
    • No v4 counterpart for ${plugin.artifactMap}, ${project.artifactMap}, ${plugin}, ${basedir}, ${session.parallel}.
    • No static version parser: Session.parseVersionRange needs a session.
    • No ArtifactHandler: isAddedToClasspath() becomes !Type.getPathTypes().isEmpty().
    • ScopeArtifactFilter differs: with classpathDependencyScopeExclude = provided or system, the v3 filter excludes nothing and the v4 one excludes that scope.
    • LocationManager (plexus-java) is a Sisu component; created with new.
    • Depends on the unreleased maven-common-artifact-filters 4.0.0-SNAPSHOT (Port to the Maven 4 APIΒ maven-common-artifact-filters#130).

    Consumers that break: maven-surefire-plugin, maven-failsafe-plugin, surefire-its in this repository. Outside it, only the maven-plugin-plugin mplugin-305_* ITs extend AbstractSurefireMojo, and they pin 3.1.0.

    Improvements: maven-surefire-common drops maven-core, maven-plugin-api, maven-artifact, maven-model, maven-resolver-api/-util, javax.inject, org.eclipse.sisu.plexus.

    Recommendation: port the library only together with maven-surefire-plugin and maven-failsafe-plugin, and keep a 3.x line. The API first needs the request flags on Session, a session-free version parser, and test fixtures for Dependency and Project.

    maven-release: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-SNAPSHOT, Java 17. The library modules (maven-release-api, maven-release-manager, both policies) compile against org.apache.maven.api only and pass; the plugin is a consumer and is excluded. The immutable model forced a redesign of the POM-rewriting layer, and plugin/extension/report artifact resolution is reduced.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ before 876 tests (api 0, manager 769, odd-even 11, semver 78, plugin 18), 0 failures, 18 skipped (manager); after 791 (api 0, manager 700, odd-even 12, semver 79), 0 failures, same 18 skipped. Spotless and checkstyle clean. The manager lost 88 tests and gained 19 (net -69). The 88 are the tests of the removed Maven 3 model subclasses, almost all asserting UnsupportedOperationException for methods that no longer exist: DomTripDependencyTest 24, DomTripParentTest 11, DomTripExtensionTest 10, DomTripDependencyManagementTest 6, and 37 of the 45 in DomTripBuildTest. The behaviour that was real (get/set version, group and artifact id, element name) is covered by the 10 tests of DomTripMavenCoordinateTest; the parent test that added or removed a missing <version> element is not carried over. The other 9 new tests are 3 in DomTripBuildTest, 5 in DependencyInjectionTest and 1 DiIndexTest (plus one DiIndexTest in each policy module). The plugin's 18 unit tests and the run-its profile (it lives in the plugin module) were not run, before or after: the plugin does not compile against the ported libraries, so there is no "after".

    Public API changes

    • ReleasePhase.execute/simulate, ResourceGenerator.clean, Release*Request.get/setReactorProjects: List<MavenProject> β†’ List<org.apache.maven.api.Project>.
    • ReleaseEnvironment.getSettings() returns org.apache.maven.api.settings.Settings; new Session getSession() (phases need it for collectDependencies and the XML factories), DefaultReleaseEnvironment.setSession.
    • ReleaseDescriptor.getOriginalScmInfo, ReleaseDescriptorBuilder.addOriginalScmInfo and the modello-generated descriptor: org.apache.maven.model.Scm β†’ org.apache.maven.api.model.Scm. IdentifiedScm is immutable: new IdentifiedScm(Scm, id), no setters (the v4 Scm has a protected builder constructor, so it can still be subclassed).
    • VersionPolicyRequest.get/setMetaData: artifact.repository.metadata.Metadata β†’ org.apache.maven.api.metadata.Metadata.
    • Version.compareTo no longer throws VersionComparisonConflictException (one ordering instead of two; the class stays, never thrown). New versions.ArtifactKeys (versionlessKey, isSnapshot, SNAPSHOT_VERSION, VERSION_FILE_PATTERN) replaces ArtifactUtils.
    • DefaultReleaseManagerListener(Log) β†’ (org.slf4j.Logger); the API has no Log.
    • ModelETL.getModel() returns the new PomModel; ModelETLRequest.setProject(Project); AbstractRewritePomsPhase.transformScm takes (Project, PomModel, Model originalModel, ...). DomTripDependency/Extension/Parent/DependencyManagement/PluginManagement/Reporting/ReportPlugin are gone; the other DomTrip classes implement the new PomModel, PomBuild, PomPlugin, PomProfile, PomScm views instead of subclassing Maven 3 model classes.
    • ScmRepositoryConfigurator.getConfiguredRepository(..., Settings) takes the v4 Settings. AbstractMavenExecutor, ForkedMavenExecutor, InvokerMavenExecutor take a SettingsXmlFactory; getSettingsWriter() β†’ getSettingsXmlFactory(). PomFinder(Logger, ModelXmlFactory). GenerateReleasePomsPhase takes a ModelXmlFactory instead of ModelInterpolator. MavenCrypto(SecDispatcher) on plexus-sec-dispatcher 4.2.0.
    • @Named/@Singleton/@Inject move to org.apache.maven.api.di, @Description is dropped; Sisu no longer discovers any component. DefaultStrategy, DefaultVersionPolicy, DefaultNamingPolicy become @Named("default") (see traps below).

    Design changes forced by the immutable model

    • The DomTrip layer was DomTripModel extends Model plus a dozen subclasses of Maven 3 model classes, overriding the setters they needed and throwing UnsupportedOperationException for the rest. The v4 Model cannot be edited in place, so the rewrite phases now edit the DOM through five small Pom* views (setVersion, setScm, coordinate setVersion, Properties). This is a redesign, not a port: the transform package goes from 2151 to 1598 lines, including the new interfaces.
    • GenerateReleasePomsPhase built the release POM by cloning the MavenProject and calling setters; it now derives the release model with Model.newBuilder(effective, true).

    Gaps

    • MavenProject.getOriginalModel() (9 uses) has no equivalent. The original model is read again from the POM file with ModelXmlFactory. Consequence: generate-release-poms runs after rewrite-poms-for-release, so it now reads plugin, extension and plugin-dependency declarations that are already rewritten; Maven 3 kept the load-time snapshot.
    • No plugin, extension or report artifact API and no RELEASE/LATEST resolution (MavenProject.getPluginArtifacts/getReportArtifacts/getExtensionArtifacts and their maps). Versions come from the effective model. A plugin, report plugin or extension without a version stays without one in the release POM (Maven 3 wrote the resolved version; one expected file had <version>RELEASE</version> and was changed), and CheckDependencySnapshotsPhase cannot see a snapshot behind it.
    • Session.collectDependencies(project, TEST_COMPILE βˆͺ TEST_RUNTIME) replaces getArtifacts/getDependencyArtifacts. It throws when any dependency POM cannot be read, where Maven 3 still listed the declared artifact; the code falls back to the declared coordinates and an empty transitive set.
    • MavenProject.getParentArtifact(): only Project.getParent(), present when the parent project was built.
    • No ModelInterpolator. The super POM path unaligning in GenerateReleasePomsPhase uses plexus-interpolation over the v4 model (kept as a dependency).
    • api.Version needs a VersionParser service, but Version and DefaultVersionInfo are plain value classes. They use the resolver's GenericVersionScheme (new direct dependency maven-resolver-util); the ComparableVersion cross-check is dropped.
    • No crypto API. MavenCrypto uses plexus-sec-dispatcher 4.2.0, whose legacy dispatcher can only decrypt. encryptSettings needs a v4 master dispatcher configuration; without one the passwords go unencrypted into the temporary settings.xml for the forked build (the failure was already swallowed in Maven 3).
    • maven-scm-manager-plexus gets its providers through Sisu map injection, which the v4 container does not do. ReleaseScmManager reads META-INF/sisu/javax.inject.Named itself and instantiates the providers that have a public no-argument constructor.
    • The parent sets <proc>none</proc>, so META-INF/maven/org.apache.maven.api.di.Inject is maintained by hand in all three modules; DiIndexTest fails when a @Named class is missing (checked by removing DefaultStrategy).
    • Not verified: injection of Prompter and SecDispatcher in a real Maven 4 plugin container. ApiRunner.createSession binds neither, so the tests bind them. No release was run end to end.
    • Traps: a bare @Named is the empty key in Map<String, T> injection, not default as in Sisu (Policy 'default' is unknown, available: []); model.with().parent(null).build() does not clear the parent (null is ignored on a builder from with(); use withParent(null) or Model.newBuilder(model, true)); DependencyResolver.collect needs a ProjectManager service that only maven-core provides.
    • Release POM content changes with the v4 effective model: no repositories/pluginRepositories (the central declarations are no longer in the model) and three extra properties (project.build.outputTimestamp, project.build.sourceEncoding, project.reporting.outputEncoding). 58 expected files under src/test/resources/projects/generate-release-poms were adjusted for this.
    • Tests: there is no project builder outside maven-core. The harness builds TestProject from the ModelBuilder of maven-impl and resolves against a local repository seeded from src/test/remote-repository (marked >central=), with a stub ProjectManager. It uses DefaultDependencyCoordinates and InternalSession from maven-impl, which are internal classes.

    Consumers that break: maven-release-plugin (same repository): 15 compile errors in 8 classes, measured by compiling its sources against the ported jars. AbstractReleaseMojo:131 (setSettings takes the Maven 3 Settings); CleanReleaseMojo, RollbackReleaseMojo, PrepareReleaseMojo, BranchReleaseMojo, PerformReleaseMojo, UpdateVersionsMojo (setReactorProjects(getReactorProjects()) with List<MavenProject>, and new DefaultReleaseManagerListener(getLog()) with Log); AbstractScmReadReleaseMojo:145 and UpdateVersionsMojo:124 (addOriginalScmInfo with the Maven 3 Scm). At runtime its @Inject ReleaseManager and ScmManager would also find no Sisu components. maven-scm-publish-plugin, by reading: AbstractScmPublishMojo:352 passes a Maven 3 Settings to getConfiguredRepository, and it injects ScmRepositoryConfigurator with javax.inject. No other repository under the Apache Maven plugin repositories imports org.apache.maven.shared.release.

    Improvements: drops maven-core, maven-model, maven-model-builder, maven-artifact, maven-settings, maven-plugin-api, maven-repository-metadata, plexus-interactivity-api, plexus-cipher, plexus-sec-dispatcher 2.0 (it clashed by coordinates with the 4.2.0 that maven-impl brings), maven-scm-manager-plexus, javax.inject, org.eclipse.sisu.inject, sisu-maven-plugin, and the test-only plexus-testing, org.eclipse.sisu.plexus and four resolver modules.

    Recommendation: port the libraries for a Maven 4 release plugin, but only together with a Maven 4 port of the plugin. The API first needs a way to resolve plugin and extension versions and an original (file) model on Project; without them the release POM and the snapshot check are weaker than on 3.x. Keep the 3.x line for Maven 3 builds.

    maven-enforcer: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-SNAPSHOT, Java 17. enforcer-api and enforcer-rules ported; 3 of 38 rules removed for lack of API; maven-enforcer-plugin and maven-enforcer-extension excluded from the reactor.

    Rebased 2026-10-06 onto master, carrying apache/maven-enforcer#1046, #1047 and #1051. The legacy rule API stays removed, as #1047 announces. Unit tests: 359 run, 0 failed (357 before the rebase, plus upstream's 2 new ones).

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ before 300 tests (rules 276, plugin 24), 0 failures; after, library modules only: rules 347 (272 ported, 75 new), 0 failures. Spotless, checkstyle and RAT clean. ITs (154 invoker projects in the plugin module) cannot run after, because the plugin no longer builds. Removed tests: the 3 of the removed rules and 1 of a test-only PluginParameterExpressionEvaluator subclass.

    Public API changes

    • enforcer-api, the SPI third-party rules implement: AbstractEnforcerRuleConfigProvider.getRulesConfig() returns org.apache.maven.api.xml.XmlNode instead of Xpp3Dom. The deprecated EnforcerRule, EnforcerRule2 and EnforcerRuleHelper are removed; they expose PlexusContainer and the Maven 3 Log. AbstractEnforcerRule, EnforcerRuleBase, EnforcerLogger, EnforcerLevel, EnforcerRuleException, EnforcerRuleError are unchanged.
    • enforcer-rules: DI moves to org.apache.maven.api.di, so Sisu finds no rule. Rules take Project, Session, ProjectManager, VersionParser instead of MavenProject, MavenSession, RuntimeInformation, PluginManager, RepositorySystem.
    • utils.ExpressionEvaluator no longer extends PluginParameterExpressionEvaluator; ${mojo.*}, ${plugin.*}, ${localRepository} are not supported.
    • Removed rules: requireUpperBoundDeps, banDynamicVersions, requireProfileIdsExist.

    Gaps

    • Node has no pre-managed version and no declared version constraint. requireUpperBoundDeps compares the pre-managed version and banDynamicVersions checks ranges and LATEST/RELEASE of transitive dependencies; a port would silently narrow both, so they are removed.
    • Session has no requested (-P) profile ids: requireProfileIdsExist is removed.
    • No original model on Project: five rules re-parse pom.xml through ModelXmlFactory.
    • No resolved-artifact view of a project: requireSameVersions, bannedDependencies/requireReleaseDeps (searchTransitive=false) and enforceBytecodeVersion now run a resolution request.
    • No public ProfileActivationContext or no-op ModelProblemCollector: requireOS carries hand-written implementations.
    • requirePluginVersions is tested against mocks only; its check for versions from the default lifecycle bindings is not verified on Maven 4.
    • Rule configuration from <rules> (Plexus ComponentConfigurator from Xpp3Dom) has no API equivalent; it belongs to the plugin port. Nothing ran end to end in a real Maven 4 build.

    Consumers that break

    • maven-enforcer-plugin (EnforceMojo, DisplayInfoMojo, DefaultEnforcementRuleHelper, EnforcerRuleCache) and maven-enforcer-extension (AbstractMavenLifecycleParticipant), both in this repository.
    • mojohaus/extra-enforcer-rules: its 9 rules still compile against the unchanged SPI types, but inject MavenProject/MavenSession through javax.inject, so Maven 4 DI does not find them; it has to move with the plugin.
    • Any third-party rule implementing EnforcerRule/EnforcerRule2 or calling EnforcerRuleHelper.getComponent.

    Improvements: enforcer-api drops everything but maven-api-xml; enforcer-rules drops maven-core, maven-artifact, maven-plugin-api, maven-model(-builder), maven-settings, maven-resolver-api/-util, javax.inject, org.eclipse.sisu.plexus, plexus-utils, plexus-xml.

    Recommendation: do not release. The rules are usable only once maven-enforcer-plugin can configure and look up v4 rules, which is the larger half. Ask apache/maven for a pre-managed version and declared constraint on Node and requested profile ids on Session before dropping the 3 rules for good. Keep a 3.x line for Maven 3 and for extra-enforcer-rules.

    maven-plugin-tools: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 5.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify -P run-its with Maven 4.0.0-rc-7, JDK 21, library modules β†’ api 61 unit + 15 IT before and after; generators 17 (1 skipped) before and after; annotations 37 before, 42 after (new: DI wiring, sources-jar resolution); 0 failures. Spotless clean. maven-plugin-plugin (12 unit, 32 ITs) and maven-plugin-report-plugin (3 unit, 12 ITs) were green before and are excluded from the reactor after.

    Everything except the descriptor model moves to the Maven 4 API. PluginDescriptor, MojoDescriptor and Parameter stay on org.apache.maven.plugin.descriptor because the tools still write the Maven 3 plugin.xml.

    Public API changes

    • PluginToolsRequest: constructor (Session, Project, PluginDescriptor); getProject() returns Project; getDependencies() is Set<org.apache.maven.api.Artifact>; getSettings() is the v4 Settings; getRepoSession()/setRepoSession() removed.
    • PluginUtils.isMavenReport(String, Session, Project) replaces (String, MavenProject); deprecated GeneratorUtils.isMavenReport removed; toComponentDependencies takes v4 Dependency.
    • PluginHelpGenerator: setMavenProject(Project); setVelocityComponent β†’ setVelocityEngine.
    • MojoAnnotationsScannerRequest takes Session, Project and v4 artifacts; JavadocLinkGenerator/JavadocSite take v4 Settings.
    • @Named/@Singleton/@Inject move to org.apache.maven.api.di: Sisu no longer finds the extractors, scanners or converters, so they cannot be injected under Maven 3.

    Gaps (rc-7)

    • The descriptor model exists (org.apache.maven.api.plugin.descriptor, PluginXmlFactory), but MojoDescriptor has no threadSafe, instantiationStrategy, executionStrategy or requiresReports, Parameter has no implementation or requirement, and PluginDescriptor has no dependencies. It cannot carry a Maven 3 plugin.xml, so it cannot be the tools' internal model. There is also no plugin manager or descriptor lookup service.
    • MavenProject#getArtifacts() has no Project equivalent; Session#resolveDependencies(project, PathScope.MAIN_COMPILE) returns paths only and covers compile and provided scope, not runtime.
    • MavenProject#getProjectReferences() has no equivalent; projects are matched from Session#getProjects() by GAV.
    • No Dependency factory outside a resolved graph; no Version factory outside a Session; Settings has no getActiveProxy().
    • Plexus components (ArchiverManager, VelocityComponent) cannot be injected through api.di; sources jars are unpacked with java.util.zip (with a zip-slip check), so only *-sources.jar is supported.
    • <proc>none</proc> in the parent: the DI index files are maintained by hand; a new test fails when an entry is missing.
    • ProjectManager#getEnabledSourceRoots is stubbed in tests; nothing ran the extractors end to end on a real Maven 4 project.

    Consumers that break

    • maven-plugin-plugin DescriptorGeneratorMojo, HelpGeneratorMojo; maven-plugin-report-plugin PluginOverviewRenderer, GoalRenderer. Both are excluded from the reactor.
    • A Maven 3 plugin build cannot use these libraries at all: Maven 3.9 has no Session/Project API.

    Improvements: drops maven-core, maven-settings, maven-resolver-api, javax.inject, plexus-archiver, plexus-velocity, sisu-maven-plugin. Still needs maven-plugin-api, maven-model, maven-artifact for the descriptor model.

    Recommendation: do not release a "Maven 4 API" 5.0.0 while the public descriptor types are Maven 3. Decide first between a tools-owned descriptor model and dropping Maven 3 plugin.xml output; keep maven-plugin-tools-3.x as the line maven-plugin-plugin builds on.

    maven-archetype: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 57 tests before (archetype-common 29, maven-archetype-plugin 28), 0 failures; after 30 in archetype-common (29 ported, 1 new), 0 failures, spotless clean. The plugin (28 tests, 33 integration test projects) is a consumer that does not compile against the ported library, so it is excluded from the reactor and its tests and ITs were not run after. -Prun-its before: 20 of 33 IT projects finished (all passed) when the 30-minute time box ended. For the code with no unit test (FilesetArchetypeCreator, POM rewriting) I generated an archetype from a 3-module fixture with both builds and diffed the output trees: identical apart from the version string and a timestamp, with keepParent true and false.

    Public API changes (archetype-common)

    • ArchetypeGenerationRequest: MavenSession, RepositorySystemSession, RepositorySystem, ProjectBuildingRequest, ArtifactRepository (local and remote) getters and setters are replaced by one getSession()/setSession(org.apache.maven.api.Session); getRemoteRepositories() is now List<org.apache.maven.api.RemoteRepository>.
    • ArchetypeCreationRequest.project: MavenProject β†’ org.apache.maven.api.Project.
    • ArchetypeManager, ArchetypeDataSource, Downloader, ArchetypeArtifactManager: RepositorySystemSession β†’ Session, aether RemoteRepository β†’ API RemoteRepository. ArchetypeManager.archiveArchetype no longer declares DependencyResolutionRequiredException.
    • PomManager reads and writes the immutable org.apache.maven.api.model.Model. Constructors change: DefaultPomManager(ModelXmlFactory), DefaultOldArchetype(ArchetypeVelocity, ArchetypeArtifactManager, ModelXmlFactory), DefaultFilesetArchetypeGenerator takes ArchetypeVelocity instead of VelocityComponent, DefaultArchetypeGenerator drops RepositorySystem.
    • plexus-velocity is gone; the new ArchetypeVelocity builds the engine with the settings DefaultVelocityComponent 2.4.0 applies (read from its bytecode) plus the former VelocityConfigurator settings. The VelocityComponentConfigurator extension point is lost.
    • @Named/@Singleton/@Inject move to org.apache.maven.api.di; Sisu no longer discovers these components, so they cannot be injected under Maven 3.

    Gaps

    • No metadata resolution in the API. RemoteCatalogArchetypeDataSource now fetches archetype-catalog.xml through TransportProvider: no local repository cache, update policy or checksum check. The old lookup also matched a repository by the id of a repository it mirrors (getMirroredRepositories()); the API RemoteRepository has none, so only ids archetype and central match. Not exercised by a test (none existed).
    • RepositoryPolicy cannot be set on a repository created with Session.createRemoteRepository(id, url); the archetypeRepository URL used to get always-update and warn-on-checksum, it now gets the defaults. Mirror, proxy and authentication handling for it relies on the API resolving through toResolvingRepositories; not exercised.
    • The v4 model reader rejects <reports> (project and profile) and plugin <goals> in strict mode; the Maven 3 reader accepted them. DefaultPomManager and DefaultOldArchetype read non-strict, so any unknown element is now accepted too. MavenJDOMWriter cannot read those elements from the v4 model and leaves them untouched in the file (new test testAddParentKeepsLegacyElements).
    • Model.Builder.parent(null)/modules(null) on a builder made with Model.newBuilder(model) does not clear the value (null means inherit from base); newBuilder(model, true) is required. The first version of the port kept <modules> in the root archetype POM for this reason; the tests did not catch it, the fixture diff did.
    • maven-parent sets <proc>none</proc>, so META-INF/maven/org.apache.maven.api.di.Inject is maintained by hand (14 classes).
    • ApiRunner.createSession has no transporter. The tests register file and Apache HTTP factories with @Provides @Named on a class passed to injector.bindImplicit; that pulls maven-resolver-transport-file and -apache 2.0.23 into test scope.

    Consumers that break: maven-archetype-plugin, in this repo (excluded from the reactor, not ported): CreateProjectFromArchetypeMojo (setMavenSession, setRepositorySession, setRepositorySystem, setProjectBuildingRequest, setLocalRepository, setRemoteArtifactRepositories), IntegrationTestMojo (setMavenSession, Downloader.download), CreateArchetypeFromProjectMojo (setProject(MavenProject)), UpdateLocalCatalogMojo and DefaultArchetypeSelector (RepositorySystemSession), DefaultArchetypeGenerationConfigurator (VelocityComponent, RepositorySystemSession). The plugin is a Maven 3 mojo and also relies on Sisu discovery. No other repository under the Apache Maven plugin repositories, shared, shared-4 or skins imports archetype-common.

    Improvements: drops maven-core, maven-model, maven-artifact, maven-resolver-api, javax.inject, plexus-velocity, and test-side plexus-testing, maven-resolver-connector-basic, maven-resolver-transport-http. plexus-utils and plexus-xml stay (generated archetype descriptor and catalog readers).

    Recommendation: the library ports without dropping behaviour except the remote-catalog and repository-policy gaps above. Do not release it before the plugin is ported to the Maven 4 mojo API and its 33 ITs run against it; keep the 3.x line for Maven 3 users.

    maven-resolver-ant-tasks: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 3.0.0-SNAPSHOT, Java 17.

    Verified locally: mvn verify -P run-its with Maven 4.0.0-rc-7, JDK 21 β†’ 59 tests before, 60 after (new AntModelResolverTest), 0 failures; the POM-reading parity golden file and all 11 ResolveTest cases pass unchanged; spotless clean. Cost: run-its build 2:46 β†’ 9:17, not profiled.

    Only the model and settings layer moves to the v4 API. Collection, resolution, install and deploy stay on the resolver's RepositorySystem.

    Central finding: no public Session outside Maven. Ant has no Maven runtime. The only route is org.apache.maven.impl.standalone.ApiRunner in maven-impl, which is internal. Its session has no transporter, cannot take the Ant project's RepositorySystem (local repository, mirrors, proxies, credentials), and a custom ModelResolver replaces the default only as a @Named @Priority class, not through bindInstance.

    Public API changes (internal packages, but the uber jar is what Ant users load)

    • AntRepoSys.loadModel and Pom.getModel return the immutable org.apache.maven.api.model.Model; CreatePom builds through new addRepository, addDeveloper, setScm.
    • AntSecDispatcher, AntSettingsDecryptorFactory, SettingsUtils removed: the v4 SettingsBuilder decrypts and converts profiles. A Maven 3 settings-security.xml master password still decrypts.
    • The tasks need Java 17 (was 8).

    Gaps

    • Dependency POMs still go through the Maven 3 model builder via maven-resolver-supplier-mvn4; only the root POM uses the v4 ModelBuilder, so both builders are on the classpath.
    • A repository declared in a POM loses its policies: the v4 RemoteRepository has only id, URL and protocol. Read from the API; no test covers it.
    • BUILD_PROJECT needs .mvn or root="true", so the root POM is built with BUILD_EFFECTIVE/CONSUMER_DEPENDENCY; setProcessPlugins(false) has no equivalent.
    • The mvn4 supplier defaults to the transitive dependency manager; the classic one is now set explicitly. Other supplier defaults not diffed.
    • The shaded jar must merge META-INF/maven/org.apache.maven.api.di.Inject and leave org.apache.maven.impl and api.spi unrelocated; the uber jar grows 4.95 MB β†’ 8.22 MB.

    Consumers that break: none in the estate; user Ant builds need Java 17 and see the v4 model from Pom.getModel.

    Improvements: drops maven-settings-builder, plexus-cipher, plexus-sec-dispatcher, maven-resolver-supplier-mvn3; fixes an NPE on an unreadable settings.xml.

    Recommendation: do not merge. The port rests on internal ApiRunner; ask apache/maven for a supported standalone Session factory that accepts a RepositorySystem and a ModelResolver. Keep 2.x on Maven 3 for Java 8 Ant users.

    maven-indexer: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 8.0.0-SNAPSHOT, Java 17. indexer-core ported; indexer-cli and search-backend-indexer compile but fail at runtime (Sisu wiring), left unported.

    Verified locally: mvn -B verify with Maven 4.0.0-rc-7, JDK 21. indexer-core: 245 tests, 0 failures, 1 skipped, plus 5 ITs, before and after. indexer-reader 23 (1 skipped), search-api 4, search-backend-smo 15 (14 skipped), search-backend-remoterepository 39: unchanged. indexer-cli: 7 tests, 0 errors before, 5 errors after (its 6 ITs no longer reached). search-backend-indexer: 9 tests (7 skipped), 0 errors before, 2 errors after. The examples profile (indexer-examples-* tests, off by default) was not run. Spotless clean.

    Public API changes

    • ArtifactContext.getPomModel(): org.apache.maven.model.Model (maven-model) β†’ org.apache.maven.api.model.Model. This is the only Maven type in the public API; MinimalArtifactInfoIndexCreator reads name, description and packaging from it.
    • POMs are read with org.apache.maven.model.v4.MavenStaxReader (maven-support), and ArtifactLocator no longer handles XmlPullParserException.
    • @Named/@Singleton/@Inject on all 19 components move from javax.inject to org.apache.maven.api.di. Sisu and Guice no longer discover them, so WireModule/SpaceModule, InjectedTest and Plexus lookups return nothing. Bare @Named is dropped because the v4 annotation requires a value.
    • Named creators (min, jarContent, maven-plugin, ...) and List<IndexCreator>/Map<String, IndexCreator> injection work in maven-di as-is.

    Gaps

    • maven-compiler-plugin has <proc>none</proc>, so META-INF/maven/org.apache.maven.api.di.Inject is maintained by hand (19 classes); a new component missing from it fails with "No binding".
    • maven-di has no empty-collection injection: DefaultIndexUpdater(…, List<IndexUpdateSideEffect>) failed with a DI error because no side effect is bound. Fixed with @Nullable on the parameter (maven-api-annotations); the existing null check covers it. Behavioural difference: the list is null, not empty, when nothing is bound.
    • No API-level POM reader outside a container: ModelXmlFactory needs a Maven 4 injector, and MavenStaxReader sits in maven-support, which is not maven-api-*.
    • Tests: Sisu's InjectedTest replaced by a local AbstractTestSupport that builds Injector.create().discover(...); no test removed.
    • Not ported: archetype-catalog (ArchetypeDataSource, optional, Maven 3 artifact) and plexus-utils StringUtils/FileUtils/Xpp3Dom/DAG, which are not Maven APIs; plexus-utils is now declared explicitly because it used to arrive through maven-model.
    • Build: javaVersion 11 β†’ 17 makes modernizer flag six String.format sites; modernizer pinned at 11 to keep them out of this change. indexer-examples-spring test-only maven-model-builder pinned to a new maven3.version (3.9.16) because it uses the v3 ModelWriter.

    maven-api-core: not appropriate here. Nothing in indexer-core uses Session, Artifact, Project or any service; the three files with Maven 3 API use only the model. The port depends on maven-api-model, maven-api-di, maven-api-annotations and maven-support (which pulls maven-xml, maven-api-settings/-toolchain/-metadata/-plugin, all Java 17). For an artifact consumed by IDEs, repository managers and search tooling outside Maven, dropping the Maven dependency is the better port: only name, description and packaging are read, which a JDK StAX parse covers, and DI could be JSR 330 only (javax.inject/jakarta.inject), which Sisu, Guice and Spring all honour. Forcing org.apache.maven.api.di on those consumers replaces a de-facto standard with a Maven-internal one. Not implemented; measured only the api.di port.

    Consumers that break

    • In this repo (compile, fail at runtime with Guice NullInjectedIntoNonNullable because Sisu finds no components): indexer-cli (Components, NexusIndexerCli, NexusIndexerCliTest), search-backend-indexer (IndexerCoreSearchBackendPagingTest, IndexerCoreSearchBackendImplTest); indexer-examples-basic (BasicUsageExample) and indexer-examples-spring use the same Guice/Sisu wiring, tests not run.
    • the Apache Maven repositories plugins, shared, shared-4 and misc: no Java import of org.apache.maven.index and no org.apache.maven.indexer dependency outside the repo itself. External consumers (IDE, repository manager, search tooling) cannot be checked from here; anyone calling ArtifactContext.getPomModel() or wiring through Sisu breaks.

    Improvements: drops javax.inject, org.eclipse.sisu.inject and guice (provided) from indexer-core, and maven-model.

    Recommendation: do not merge as is. Keep indexer-core 7.x on JSR 330 for the non-Maven consumers; if a Maven 4 line is wanted, prefer replacing MavenXpp3Reader with a small StAX read and keeping javax.inject, rather than org.apache.maven.api.di.

  17. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Wave 4 findings, part 1 of 4: maven-acr-plugin to maven-dependency-plugin

    Each plugin is a local branch agent/mvn4-api with a "Build with Maven 4 only" commit and a "Port to the Maven 4 API" commit; the PRs are not opened yet.

    maven-acr-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT (was 3.2.1-SNAPSHOT), Java 17.

    Rebased 2026-10-06 onto master, which carries apache/maven-acr-plugin#155 and #157. The port keeps the Sisu-indexed AppClientArtifactHandler and AppClientLifecycleMappingProvider that #157 adds; whether rc-7 discovers them is not yet verified. 2 unit tests pass; ITs not rerun.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify β†’ BUILD SUCCESS before and after; the plugin has no unit tests (0 before, 0 after). mvn verify -Prun-its β†’ 4/4 invoker ITs pass before (3m20s) and after; spotless:check clean. Consumed released artifacts only, no local snapshots: maven-archiver 4.0.0-beta-5, maven-filtering 4.0.0-beta-1, maven-plugin-plugin 4.0.0-beta-1.

    User-visible changes

    • AcrMojo implements org.apache.maven.api.plugin.Mojo, annotated with org.apache.maven.api.plugin.annotations; project, session, Log, ProjectManager and MavenFileFilter are @Injected. Goal acr, phase package and every parameter name/property (maven.acr.*, jarName, excludes, archive, filters, outputTimestamp) are unchanged; basedir and outputDirectory are now Path (same XML syntax).
    • Runs only on Maven 4: it no longer loads under Maven 3 (javax.inject, maven-plugin-api, maven-core, maven-artifact dropped). A 3.x line has to stay for Maven 3 users.
    • Main artifact is attached with ProjectManager.attachArtifact(project, project.getMainArtifact(), jar) instead of project.getArtifact().setFile.
    • Bug fixed on the way: the old code appended META-INF/application-client.xml to the user's excludes list in place; it now copies the list.
    • New Providers class (@Provides) supplies ProjectManager and BuildContext; the second is needed because DefaultMavenFileFilter 4.0.0-beta-1 requires a BuildContext binding (the same workaround maven-resources-plugin carries). Without both, every IT failed with "No binding to construct an instance for key ...".

    Gaps

    • org.eclipse.sisu:org.eclipse.sisu.plexus must be a compile dependency: ThreadBuildContext (plexus-build-api 0.0.7) needs org.codehaus.plexus.logging.AbstractLogEnabled, which the v4 plugin realm does not provide. The four ITs pass without it (the <extensions>true</extensions> realm supplies the class), but invoking the goal directly on a jar-packaged project (mvn ...:maven-acr-plugin:4.0.0-beta-1-SNAPSHOT:acr) failed with "Unable to lookup Mojo" until the dependency was added; afterwards it built the jar. maven-resources-plugin master carries the same dependency.
    • @Mojo(dependencyResolutionPathScopes = "runtime") (the v4 replacement for requiresDependencyResolution = RUNTIME) cannot be used: maven-plugin-plugin 4.0.0-beta-1 fails with "Method: 'dependencyResolutionPathScopes' not found in class MojoAnnotationContent". The attribute is omitted; this is safe here because MavenArchiver.getManifest resolves MAIN_RUNTIME on demand through DependencyResolver, which is what all four ITs exercise (manifest classpath included).
    • The app-client packaging still needs META-INF/plexus/components.xml (LifecycleMapping + ArtifactHandler). A pure v4 registration via PackagingProvider + TypeProvider compiled and its beans were indexed, but with the components.xml removed and a clean build, it-01 failed with Unknown packaging: app-client. DefaultPackagingRegistry.lookup in maven-4.0.x resolves only through the Sisu LifecycleMapping component and never consults PackagingProvider, so the SPI is inert. The experiment was reverted; the file is unchanged and works under rc-7.
    • maven-plugin-testing v4 harness was not added: no unit test existed to port.

    Improvements: drops javax.inject, maven-plugin-api, maven-core, maven-artifact, maven-plugin-annotations, plexus-utils (FileUtils replaced by java.nio.file.Files). Adds maven-api-core/di/annotations (provided), plexus-build-api and org.eclipse.sisu.plexus.

    Recommendation: port for Maven 4; keep a 3.x line for Maven 3 builds. Follow up upstream on two items: PackagingProvider not honoured by DefaultPackagingRegistry (blocks removing components.xml from packaging plugins), and maven-plugin-tools not extracting dependencyResolutionPathScopes.

    maven-antrun-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported (two workarounds for Maven 4.0.0-rc-7 defects), 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify -Prun-its with Maven 4.0.0-rc-7, JDK 21 β†’ 4 unit tests and 29 invoker ITs before, 4 and 29 after, 0 failures (before 9:52 min, after 10:08 min); spotless clean. The "before" numbers are the 3.2.1 code built and run by Maven 4.

    Ant-visible references (all registered on the Ant project by AntRunMojo)

    Reference Before After
    maven.compile.classpath, maven.dependency.classpath, maven.runtime.classpath, maven.test.classpath Path from MavenProject.get*ClasspathElements() same ids and type; built from output directories plus Session.resolveDependencies(project, MAIN_COMPILE / MAIN_RUNTIME / TEST_RUNTIME)
    maven.plugin.classpath Path from ${plugin.artifacts} same id and type; built from the URLClassLoader URLs of MojoExecution.getPlugin().getClassLoader() (see Gaps)
    maven.project org.apache.maven.project.MavenProject changed type: org.apache.maven.api.Project
    maven.project.ref MavenAntRunProject holding a MavenProject same id; getMavenProject() now returns org.apache.maven.api.Project
    maven.project.helper MavenProjectHelper disappears; maven.session replaces it (attach goes through ProjectManager.attachArtifact)
    maven.local.repository aether LocalRepository (getBasedir()) changed type: org.apache.maven.api.LocalRepository (getPath())
    maven.local.repository.manager aether LocalRepositoryManager disappears; Session.getPathForLocalArtifact via maven.session
    maven.session none new: org.apache.maven.api.Session
    maven.dependency.artifacts none new: List<MavenAntRunDependency> (dependency + path); replaces MavenProject.getArtifacts() for the tasks

    Unchanged: the Ant properties (project.*, localRepository, settings.localRepository, one property per dependency conflict id, maven.project.dependencies.versions), the maven.project.dependencies fileset and the per-artifact filesets, and the mvn:attachartifact / mvn:dependencyfilesets task names and attributes.

    Public API changes

    • AntRunMojo implements org.apache.maven.api.plugin.Mojo (was AbstractMojo); execute() throws MojoException; DEFAULT_MAVEN_PROJECT_HELPER_REFID removed, DEFAULT_MAVEN_SESSION_REFID and DEFAULT_MAVEN_DEPENDENCIES_REFID added; copyProperties takes org.apache.maven.api.Project plus the resolved dependencies; getLocalRepository() returns org.apache.maven.api.LocalRepository.
    • MavenAntRunProject, MavenLogger (now takes api.plugin.Log), DependencyFilesetsTask.filterArtifacts (List<MavenAntRunDependency>), SpecificScopesArtifactFilter and TypesArtifactFilter (now Predicate<org.apache.maven.api.Dependency>) change signature. New MavenAntRunDependency record.
    • Parameters: ${plugin.artifacts} and ${repositorySystemSession} are no longer injected; sourceRoot / testSourceRoot (removed, fail-fast) are String instead of File; @Mojo(threadSafe, requiresDependencyResolution) has no v4 attribute in use, dependencies are resolved on demand in execute().
    • AntrunXmlPlexusConfigurationWriter (package-private) is replaced by AntrunXmlConfigurationWriter over XmlNode; output is identical for the 4 existing writer tests.

    Gaps

    • An XmlNode-typed @Parameter drops every XML attribute and namespace: DefaultBeanConfigurator.XmlConverter.toXml calls XmlNode.newInstance(name, value, null, children, null). Ant tasks are attribute-based, so the plugin reads <target> from MojoExecution.getConfiguration() instead; the injected target field stays only as the declared parameter. Consequence: runtime Maven expressions inside <target> that are not resolved at model time (for example ${session...}) are no longer evaluated by Maven; no IT covers them.
    • MojoExecution.getPlugin().getDependencies() throws an NPE from the second plugin execution in a build (DefaultMojoExecution.getDependenciesMap uses a null PluginDescriptor.getDependencyNode()); reproduced by the multiple-phase-test IT. maven.plugin.classpath is taken from the plugin realm URLs instead, which includes dependencies added in the project's <plugin><dependencies>.
    • No PathScope contains the system dependency scope (test-runtime = compile, provided, test, runtime, test-runtime), so system-scoped dependencies are absent from the classpaths, properties and filesets. No IT covers it.
    • No MojoFailureException: every Ant failure is a MojoException (build failure vs. error is lost).
    • Build.getSourceDirectory() and getTestSourceDirectory() are deprecated in the v4 model and still feed project.build.sourceDirectory; projects that only declare <sources> are not covered.
    • Anything a user script does with MavenProject through maven.project (getArtifacts(), addCompileSourceRoot, getProperties()…) has no direct v4 equivalent on api.Project.
    • Site pages (usage, tasks/*) still describe the old references; not updated.

    User-visible changes: requires Maven 4; the reference and parameter changes above; Ant scripts or custom tasks that cast maven.project to MavenProject, read maven.project.helper or maven.local.repository.manager break. No Java code under the Apache Maven repositories imports the changed types (grep over org.apache.maven.plugins.antrun / org.apache.maven.ant.tasks); POM users of the plugin were not inspected.

    Improvements: drops maven-plugin-api, maven-core, maven-artifact, maven-model, maven-plugin-annotations, javax.inject, org.eclipse.sisu.plexus, plexus-utils, plexus-xml; adds maven-api-core/annotations/model/xml/di (provided). No MXSerializer.

    Recommendation: port for Maven 4 plugins and keep a 3.x line for Maven 3 users. Before merging, ask Maven core for attribute-preserving XmlNode parameters (or document MojoExecution.getConfiguration()) and fix the null dependency node in DefaultMojoExecution.

    maven-artifact-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT (was 3.7.1-SNAPSHOT), Java 17. buildinfo, compare, describe-build-output and check-buildplan are ported; reproducible-central compiles but cannot run, and one IT cannot pass.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify before β†’ 2 tests, 0 failed, 0 skipped; after β†’ 25 tests, 0 failed, 0 skipped, but only with -Dpgpverify.skip=true (see Gaps). mvn verify -Prun-its before β†’ 13 passed, 3 failed (git-mono, git-multi, describe-multi), 0 skipped (12m10s); after β†’ 12 passed, 4 failed (the same three, plus buildinfo-dir), 0 skipped (17m18s), both run on a copy of the tree. The three common failures are not caused by the plugin: git-* stop in git-commit-id-plugin with "Could not get HEAD Ref" (the copied tree has no commits), describe-multi stops in apache-rat on build.log.1 and the Maven 4 consumer POM. spotless:check clean. Consumed: released org.apache.maven.shared:maven-archiver:4.0.0-beta-5, and the local snapshots maven-reporting-impl and maven-reporting-api 5.0.0-SNAPSHOT (branch agent/mvn4-api of maven-reporting-impl, commit 21c3da4, already in the local repository, not rebuilt).

    User-visible changes

    • Goals buildinfo, compare, describe-build-output, check-buildplan, reproducible-central keep their names, phases and parameters (buildinfo.*, reference.repo, compare.*, check.*, diagnose, outputTimestamp); buildinfoFile and check.plugin-issues are now Path. threadSafe is gone from @Mojo (the API annotation has none). Runs only on Maven 4: a 3.x line has to stay.
    • RangesUtil is no longer a Sisu component: it is a static utility returning RangeDependency records (groupId, artifactId, version, message).
    • compare: the reference is the file of the local repository when there is one (installed, or cached from the reference repository), else it is downloaded from the reference repository with the Transport service, without looking at the reactor. The log line "Comparing against N reference files from ..." now shows id (url).
    • check-buildplan: the plan is computed from the effective POM (see Gaps).
    • Dependency range messages are unchanged on the ITs (Dependency g:a:jar:v (scope) via ... has been resolved from a version range [a,b)).

    Gaps

    • check-buildplan has no v4 route to LifecycleExecutor.calculateExecutionPlan / MavenExecutionPlan. The plugins of the plan are the plugins of the effective POM's build/plugins (Maven 4 injects the packaging bindings there) that have an execution with goals in a phase up to the phase of a task (Maven 3 phase names matched through Lifecycle.aliases()) or in no phase. Not covered: tasks that are goals (-Dcheck.buildplan.tasks=foo:bar), plugins forked by @Execute, and executions whose phase only comes from the goal's default phase in a plugin descriptor when the POM gives none (those are counted as in the plan, which can over-report). The five check-buildplan-* ITs pass.
    • Version ranges: Node carries no VersionConstraint, so direct ranges come from Project.getDependencies() (overlaid with getManagedDependencies()), and transitive ones from building the POM of every node of the graph with ProjectBuilder. A dependency whose POM cannot be resolved or built hides the ranges of its own dependencies; relocated dependencies are not followed. check-buildplan-version-range-* and compare-mono (buildinfo mvn.rebuild-args) pass.
    • compare has no resolver provenance: DownloadedArtifact gives a path, not the repository. "Installed locally" is read from _remote.repositories (file>=), which resolver documents as internal. Workspace-free download uses TransportProvider; Session.createRemoteRepository does not apply mirrors to an id::url or url reference repository (not measured).
    • reproducible-central compiles against maven-reporting-impl 5.0.0-SNAPSHOT, but mvn org.apache.maven.plugins:maven-artifact-plugin:4.0.0-beta-1-SNAPSHOT:reproducible-central fails with NoClassDefFoundError: org/apache/maven/execution/MavenSession: the Doxia site tool behind AbstractMavenReport needs Maven 3 types that the plugin realm of a Maven 4 plugin does not see (the same blocker as the reporting-impl port). No IT covers this goal. @Mojo(requiresDependencyResolution = RUNTIME) cannot be written either (dependencyResolutionPathScopes is not extracted by maven-plugin-plugin 4.0.0-beta-1); the report collects the runtime graph itself.
    • IT buildinfo-dir (MARTIFACT-26) fails: it expects the warning "Ignoring artifact ...:pom:4.3.10 because it points to inexistent ..." for the main artifact of a pom-packaged module. In the v4 API a pom project has no main artifact (Project.getMainArtifact() is empty unless there are two artifacts), so there is nothing to warn about. The buildinfo itself is written correctly. The IT is unchanged.
    • mvn verify runs pgpverify: its keys map has no entries for the new artifacts, and the locally built rc-7 artifacts are unsigned, so the goal fails; pgp-keys-map.list is not updated.
    • Session has no top-level project: Project.isTopProject() is used; MavenProject.getOriginalModel() is read back from the POM file with ModelXmlFactory.

    Tests: the two existing tests are unchanged. New: RangesUtilTest, CheckBuildPlanMojoTest, PluginUtilTest, LocalRepositoryOriginTest, OutputArtifactTest (23 tests).

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-artifact, maven-resolver-api, maven-resolver-util, plexus-utils, plexus-xml, commons-io, javax.inject and maven-plugin-annotations (the Maven 3 maven-archiver 3.6.6 is replaced by 4.0.0-beta-5, used only for parseBuildOutputTimestamp). Adds maven-api-core/di/annotations and maven-xml (provided) and the two reporting snapshots.

    Recommendation: port for Maven 4 and keep a 3.x line for Maven 3. Do not release before the reporting chain is ported: the report goal cannot run. Upstream follow-ups worth filing: expose the repository of a resolved artifact and a way to resolve without the workspace; put VersionConstraint (and the pre-managed version) on Node; give the API an execution-plan service for tasks.

    maven-assembly-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17. Needs an unreleased plexus-archiver (see Gaps, first item).

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 273 unit tests before, 271 after, 0 failures/errors/skipped both (3 tests removed, 1 added, listed below); checkstyle, RAT, dependency:analyze and spotless:check pass. mvn verify -Prun-its (155 project ITs): the before run hit the 30 min time-box after 65 ITs (65 passed, 0 failed; exit=143). After: the same 65 β†’ 65 passed in 7 min, and the other 90 β†’ 89 passed, 1 failed (depSet-transFromProfile, which the POM's own pomExcludes excludes from run-its; I listed it by hand, so it is not a regression). The ITs ran as two -Dinvoker.test= batches (the 65 that finished before, then the remaining 90) because the full profile exceeds the time-box on this machine. Shared snapshots consumed: maven-archiver 4.0.0-beta-6-SNAPSHOT, maven-filtering 4.0.0-beta-2-SNAPSHOT, maven-common-artifact-filters 4.0.0-SNAPSHOT (all from their local agent/mvn4-api/master worktrees), plexus-archiver 5.0.0-SNAPSHOT (master plus a 4-line local patch, asm-plexus-archiver-prototype.diff). maven-mapping is not a dependency of the plugin (no import, not in the tree), so nothing is lost there.

    Public API changes (for people who call or extend the plugin classes; the descriptor model Assembly, ModuleSet, ... is unchanged)

    • AbstractAssemblyMojo implements org.apache.maven.api.plugin.Mojo; services are @Inject fields (Session, Project, Log, MojoExecution, AssemblyArchiver, AssemblyReader, MavenReaderFilter). The four-argument constructor is gone.
    • AssemblerConfigurationSource: MavenProject β†’ org.apache.maven.api.Project, MavenSession getMavenSession() β†’ Session getSession(), MavenArchiveConfiguration is now org.apache.maven.shared.archiver (its getManifestFile() is a Path).
    • New artifact.AssemblyArtifact replaces org.apache.maven.artifact.Artifact throughout (resolver, tasks, filters). The v4 API splits coordinates (Dependency), file and dependency trail; AssemblyArtifact holds all three and keeps the v3 getter names that ${artifact.*} / ${module.*} expressions use.
    • ProjectBuilder, ArtifactHandlerManager, RepositorySystem, PlexusContainer, BasicComponentConfigurator are no longer constructor arguments of the phases, the resolver and DefaultAssemblyArchiver. AddDependencySetsTask and ModuleSetAssemblyPhase lose their ProjectBuilder parameter; FilterUtils.filterProjects gains a Session.
    • AssemblyProxyArchiver no longer implements the deprecated Archiver methods (addDirectory(...), addArchivedFileSet(File, ...), getFiles, setUseJvmChmod, setLastModifiedDate, ...): plexus-archiver 5.0 removed them.
    • ContainerDescriptorHandler SPI is unchanged (ArchiveFinalizer + FileSelector); how handlers are found changed, see Gaps.

    Gaps (what has no v4 equivalent or had to be worked around; each verified by a concrete failure)

    • ArchiverManager cannot be obtained without Sisu in a v4 mojo, and plexus-archiver's "no DI" mode is incomplete. Probe plugin on rc-7: Lookup.lookup(ArchiverManager.class) β†’ NoSuchElementException; lookupMap(ArchiverManager.class) is empty. Cause: DefaultArchiverManager (plexus-archiver src/main/java/org/codehaus/plexus/archiver/manager/DefaultArchiverManager.java) is a javax.inject @Named @Singleton bean whose constructor takes Map<String, Provider<Archiver>> etc., a Sisu-only hint-keyed map, and Maven 4 registers javax.inject @Named("hint") beans by class name (next item). lookupMap(Archiver.class) does list the archivers, keyed by class name (org.codehaus.plexus.archiver.zip.ZipArchiver), so hint zip is unavailable. plexus-archiver master (5.0.0-SNAPSHOT) already has new ServiceLoaderArchiverManager() (no DI, META-INF/services/org.codehaus.plexus.archivers.spi.ArchiverProvider), and the plugin uses it. But archivers it creates still NPE in addArchivedFileSet (unpacking, every <unpack>true): AbstractArchiver.java:132 declares @Inject private Provider<ArchiverManager> archiverManagerProvider (used at :589 in asResourceCollection, reached from addArchivedFileSet :646); with no container it stays null. Same NPE for archivers taken from lookupMap and for new ZipArchiver(). 4.14.0 has the same field (AbstractArchiver.java:144, use at :673) and no ServiceLoaderArchiverManager, so the 4.x line cannot be made Sisu-free without a backport. Candidate fix PR for codehaus-plexus/plexus-archiver (master): make asResourceCollection fall back to new ServiceLoaderArchiverManager() when the provider is null (4 lines, asm-plexus-archiver-prototype.diff; with it addArchivedFileSet works and all 155 ITs' unpacking passes); better, let the ServiceLoader providers/ArchiverFactory hand the manager to the archivers they create, and add a test that unpacks through new ServiceLoaderArchiverManager().
    • javax.inject @Named("hint") beans lose their hint in a Maven 4 plugin. Probe: a @javax.inject.Named("sisu-h") Handler is in lookupMap(Handler.class) under probe.SisuHandler, lookup(Handler.class, "sisu-h") fails; @org.apache.maven.api.di.Named("di-h") and META-INF/plexus/components.xml role-hints work. The same applies to core's ComponentConfigurators (keyed org.codehaus.plexus.component.configurator.BasicComponentConfigurator). Consequence for the SPI: third-party ContainerDescriptorHandlers declared with javax.inject.@Named("hint") cannot be selected by <handlerName>hint</handlerName> any more; components.xml or api.di.@Named ones can. The built-in handlers (file-aggregator, metaInf-services, metaInf-spring, plexus) moved to api.di.@Named. Handlers are looked up through Lookup.lookupMap(ContainerDescriptorHandler.class) at use time.
    • No Plexus component configurator. new BasicComponentConfigurator() in the plugin realm: NoClassDefFoundError: com.google.inject.spi.TypeConverter; obtaining it from Lookup.lookupMap(ComponentConfigurator.class) fails the same way on provisioning (IT massembly-345, archiverConfig). Replaced by internal.BeanConfigurator (setter or field per child element; String, numbers, boolean, enum, File, Path, collections/arrays of those, - to camelCase). Anything the Plexus converters did beyond that (for example nested objects) is not supported for archiverConfig and handler <configuration>; unverified for exotic archiver options.
    • Mojo parameter types: PlexusConfiguration archiverConfig and Xpp3Dom fail in v4 ("Cannot create instance of ..."); archiverConfig is now XmlNode, its XML text is handed to the archiver configuration as before. Descriptor model Xpp3Dom fields (handler <configuration>) are unaffected (they are read by modello, not by the mojo configurator).
    • ${project.basedir} default is wrong in a reactor: it resolved to the directory Maven was started in, not the child's (11 dependency-set ITs failed with "Error locating assembly descriptor"). The basedir parameter is gone; the value comes from the injected Project.
    • Dependency resolution: DependencyResolverRequest needs a non-null pathScope; RESOLVE only returns dependencies with a path type, so pom/zip/sar dependencies would be dropped. The plugin uses COLLECT with the project's direct dependencies (pre-filtered by scope as classpathFilter did), managed dependencies and project repositories, walks the Node tree itself, and resolves each artifact with Session#resolveArtifact(artifact, projectRepositories) (without the repositories IT massembly-1306 fails: the session's repositories are not the project's). scope=test needs two collects (TEST_COMPILE and TEST_RUNTIME) to cover compile, provided, runtime and test; system scope rides on MAIN_COMPILE. Node has no parent link, so the dependency trail is rebuilt during the walk.
    • useTransitiveFiltering / caf actTransitively: maven-common-artifact-filters 4 dropped actTransitively and the trail (PatternIncludesArtifactFilter(patterns, boolean)), so the flag would silently do nothing. FilterUtils re-creates it in two private subclasses: the artifact is tried, then every trail element (project, ancestors) until a pattern matches; patternMatches cannot tell "no match" from "negated pattern matched", so a second filter with a trailing catch-all * is asked as well. Works, but leans on caf's first-match-wins behaviour and on the protected patternMatches; a Predicate<Dependency> with a real trail (or the flag back) in caf would be cleaner. Tests cover include/exclude via trail.
    • Project of a dependency: v3 built a MavenProject for every dependency (and a stub MavenProject(Model) when that failed). v4 has ProjectBuilder.build(request) from a POM file (the POM is resolved first) but no way to create a stub Project; on failure the plugin continues with no project and uses the artifact itself for ${artifact.*} (one IT, including-sar-dependency, hit that path: the sar's POM does not build). ProjectBuilderRequest has no builder switch for allowStubModel/validation level (v3 used minimal validation), so POMs v3 tolerated may now fail to build and lose ${artifact.build.finalName} / ${artifact.properties.x}.
    • Expression surface of ${project.*}, ${module.*}, ${artifact.*} (descriptors, archiverConfig, filtering): v3 reflected over MavenProject; v4 Project has no bean surface (getBasedir() is a Path, no getBuild() bean tree beyond the model). The plugin evaluates against the effective Model plus basedir, file, id. Not reproduced: ${project.artifact.*}, ${project.attachedArtifacts}, ${project.compileSourceRoots}, ${project.artifacts} style paths. Unverified how many real descriptors use them.
    • Project main artifact and attachments: Project#getMainArtifact() is empty for pom packaging and ArtifactManager#getPath is the only way to a file; pom-packaged projects are treated as having no file (as v3), otherwise useProjectArtifact added the POM to the archive (IT massembly-1022). Attachment files come from ArtifactManager, attachments are created with Session#createProducedArtifact(..., classifier, extension, null) plus ProjectManager#attachArtifact(project, artifact, path); the attachArtifact(session, project, type, path) default has no classifier parameter. Replacing the main artifact file (appendAssemblyId=false) uses Session#setArtifactPath.
    • @Mojo has no threadSafe and no requiresDependencyResolution attribute (only dependencyResolutionPathScopes, unused): resolution happens inside the mojo, and the plugin is not marked thread-safe. maven-plugin-tools 4.0.0-beta-3 constructor injection of a mojo is not possible (field @Inject).
    • BuildContext (plexus-build-api) is not bound in the CLI; it is looked up optionally and skipped when absent (it only refreshed the archive for IDEs).
    • Build: plexus-archiver 5.0.0-SNAPSHOT changes the Archiver interface (removed deprecated methods), so AssemblyProxyArchiver (939 lines, implements Archiver) had to drop the implementations of the removed methods; it still compiles against 4.14.0 only because the Archiver methods it no longer implements would be abstract there, i.e. it does not.

    Removed or changed tests (nothing else deleted)

    • FilterUtilsTest.filterProjectsShouldNotRemoveProjectTransitivelyIncluded and filterProjectsShouldRemoveProjectTransitivelyExcluded: a reactor project's main artifact has no dependency trail in production (v3 or v4); the tests passed only because the mock returned one.
    • ModuleSetAssemblyPhaseTest.getModuleProjectsShouldExcludeModuleAndDescendentsTransitively: same reason, it relied on a mocked getDependencyTrail().
    • DefaultDependencyResolverTest rewritten for the v4 resolver (mocked DependencyResolver/Session), AddDependencySetsTaskTest for the v4 ProjectBuilder; one test added (getDependencySetResolutionRequirementsFiltersByScope). Test projects/sessions/artifacts are Mockito stubs in the new testutils/TestStubs.

    User-visible changes

    • Runs on Maven 4 only and needs Java 17; no 3.x support, a 3.x line must stay for Maven 3 users.
    • Parameters removed from the descriptor: basedir, reactorProjects, mavenSession (all readonly). archiverConfig is now an XmlNode (same XML).
    • <archive> is the maven-archiver 4 MavenArchiveConfiguration (manifestFile is resolved as a Path).
    • Third-party ContainerDescriptorHandlers registered with javax.inject.@Named("hint") are not found by hint (see Gaps).
    • useTransitiveFiltering behaviour is preserved by plugin code, not by the library.
    • Output of descriptors that used ${project.artifact...}-style expressions may differ (see Gaps).

    Improvements: drops javax.inject, sisu-maven-plugin (Sisu index), maven-plugin-api, maven-core, maven-model, maven-model-builder, maven-artifact, maven-resolver-api/util, maven-plugin-annotations; adds maven-api-core, maven-api-di, maven-api-model, maven-api-xml, maven-api-annotations (provided). org.eclipse.sisu.plexus stays provided only for the ExpressionEvaluator interface, plexus-build-api only for the optional BuildContext type. No new runtime dependency. The Plexus configurator, the PlexusContainer lookup and the reflection over MavenProject are gone.

    Recommendation: port for the Maven 4 line once plexus-archiver ships the no-DI unpack fix (first Gap item); until then the plugin depends on an unreleased 5.0.0 and on a patch. Two upstream asks that would remove most hacks: (1) plexus-archiver: unpack without a JSR-330 container, and a released ServiceLoaderArchiverManager; (2) Maven core: honour javax.inject.@Named hints (or document that only api.di.@Named and components.xml keep them), and fix ${project.basedir} in a reactor. Keep 3.x for Maven 3.

    maven-changelog-plugin: blocked

    Branch agent/mvn4-api; PR not opened yet. Status: blocked, 4.0.0-beta-1-SNAPSHOT, Java 17. The plugin code ports and compiles; it cannot run, because every consumer of a report mojo is a Maven 3 class.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify before β†’ 23 tests, 0 failures. After β†’ 23 tests, 19 errors, 0 failures (ChangeLogReportTest 15, DeveloperActivityReportTest 2, FileActivityReportTest 2); the 4 tests that pass do not execute a report. -Prun-its before β†’ 4/4 ITs pass; after β†’ 0/4 (whole suite, no time-box hit). Spotless clean. No test deleted.

    Concrete build errors (reporting chain)

    1. Against the released maven-reporting-impl 4.0.0, with only Maven 4 API dependencies: cannot access org.apache.maven.plugin.AbstractMojo at ChangeLogReport extends AbstractMavenReport. The released base class extends the Maven 3 AbstractMojo.
    2. Against the local maven-reporting-impl 5.0.0-SNAPSHOT port (see below): compiles, but every unit test that executes a report fails with IllegalStateException: Cannot get the Maven 3 object from org.apache.maven.impl.InternalSession...#getMavenSession(). The ported AbstractMavenReport.execute() reaches the Plexus container through LegacyMavenBridge and Session.getMavenSession(). The impl port's own ITs fail the same way at runtime with A required class was missing ... org/apache/maven/execution/MavenSession: maven-core is not visible in a plugin class realm.
    3. Real build, maven-site-plugin 3.22.0 on Maven 4.0.0-rc-7, all 4 ITs: Failed to get report for org.apache.maven.plugins:maven-changelog-plugin: Unable to lookup Mojo: Cannot cast org.apache.maven.plugins.changelog.ChangeLogReport[Factory] to org.apache.maven.plugin.Mojo. Site plugin 3.x only accepts Maven 3 mojos as reports.

    Snapshots consumed: maven-reporting-impl 5.0.0-SNAPSHOT, built from maven-reporting-impl agent/mvn4-api (mvn install -DskipTests -Dinvoker.skip=true, installed into the local repository); maven-reporting-api 4.0.0 (release).

    User-visible changes

    • Version 3.0.0-M3-SNAPSHOT β†’ 4.0.0-beta-1-SNAPSHOT; needs Maven 4; <prerequisites> follows mavenVersion.
    • Goals and parameter names unchanged: changelog, dev-activity, file-activity.
    • developers: List<org.apache.maven.model.Developer> β†’ List<org.apache.maven.api.model.Developer>. The project.developers expression default is gone (the Maven 4 test container cannot evaluate an expression to a raw List); when unset, the mojo reads project.getModel().getDevelopers(). The v4 Developer is immutable, so a POM-level <developers> override in plugin configuration is no longer expressible as before. Not verified under a real build because of the block above.
    • settings parameter (${settings}) removed; credentials come from Session.getSettings().getServers(), matched on host[:port]. Users who passed a Settings object in test configurations lose that hook.
    • ScmManager is a Plexus component and v4 DI reports No binding to construct an instance for key ScmManager (seen in both unit tests and the first IT run). The mojo now obtains it with Lookup.lookup(ScmManager.class) on first use; that path is unexercised in a real build because of error 3.
    • MojoExecutionException no longer thrown (MojoException); ChangeLogReport.checkResult is public and now declares MojoException.
    • Test infrastructure moves to maven-plugin-testing-harness 4.0.0-beta-4, maven-impl, Guice and Mockito 5; resolver 1.9.27 β†’ 2.0.23; transport maven-resolver-transport-http β†’ -apache.

    Gaps

    • No Maven 4 report contract that site plugin 3.x accepts (error 3); needs a v4 maven-site-plugin, which needs the Doxia site-tools port (Port the site tools to the Maven 4 APIΒ maven-doxia-sitetools#701).
    • No Maven 4 path from a plugin realm to the site renderer (error 2); the reporting-impl port works around it with MavenSession, which is not exported.
    • No v4 DI route to Sisu/Plexus components (ScmManager); Lookup is the workaround.

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-settings, maven-plugin-annotations, javax.inject and maven-artifact (test) from the plugin's own dependencies.

    Recommendation: do not merge. Keep on 3.x until maven-site-plugin, maven-reporting-impl and doxia-sitetools have v4 releases in that order; then the remaining work here is the test-harness glue (Lookup, Session settings) and re-running the 4 ITs. The commit is a compile-clean starting point only.

    maven-checkstyle-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17. The check goal is ported and runs in a real Maven 4.0.0-rc-7 build (30 ITs). The two report goals (checkstyle, checkstyle-aggregate) are blocked by the reporting chain and are excluded from the build; their sources stay in the tree.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn -B -ntp verify before β†’ 26 tests, 0 failures, 1 skipped; after β†’ 16 tests, 0 failures, 0 skipped (CheckstyleReportTest 10 run / 1 skipped removed with the reports; every other test kept: CheckstyleViolationCheckMojoTest 6, RuleUtilTest 4, CheckstyleResultsTest 2, CheckstyleExecutorTest 1, both CheckstyleReportListener*Test 1, ViolationTest 1). -Prun-its before β†’ 49/49 invoker ITs pass (24 min); after β†’ 30/30 of the ITs that do not need a report goal pass (clean verify -Prun-its, 4:48 min); the other 19 are excluded with pomExcludes (list under Gaps). Run unexcluded, the suite was 27 of 49 on the first pass (fixes for the 3 inline-rules ITs applied afterwards, then 30 of 30). Spotless clean. dependency:analyze clean.

    Report goals: can they be ported? No, not today. Concrete errors:

    1. Real compile of the unchanged AbstractCheckstyleReport against Maven 4 API + released maven-reporting-impl 4.0.0: AbstractCheckstyleReport.java:[64,56] cannot access org.apache.maven.plugin.AbstractMojo (the released base class extends the Maven 3 AbstractMojo, which is not on a v4-only classpath).
    2. Even with a v4 reporting-impl (the 5.0.0-SNAPSHOT port), site plugin 3.x on rc-7 only accepts Maven 3 mojos as reports: Unable to lookup Mojo: Cannot cast org.apache.maven.plugins.changelog.ChangeLogReport[Factory] to org.apache.maven.plugin.Mojo (proven on maven-changelog-plugin, same chain, not re-run here). The port would also need maven-core types from reporting-impl at runtime (MavenSession), which a plugin realm cannot see.
    3. The report classes additionally use Doxia sink/i18n (CheckstyleReportRenderer, 696 lines), MavenProject and MavenReportException; all of that has to move with the chain (doxia-sitetools β†’ site plugin β†’ reporting-impl).
      Excluded from compilation: AbstractCheckstyleReport, CheckstyleReport, CheckstyleAggregateReport, CheckstyleReportRenderer (compiler excludes in the pom; sources kept).

    Non-report goal

    • check: mojo implements org.apache.maven.api.plugin.Mojo; injected Session, Project, MojoExecution, Log and the executor (@Inject @Named("default"), field injection because mojo constructor injection fails in rc-7). MojoExecutionException/MojoFailureException become MojoException.
    • Executor (DefaultCheckstyleExecutor): @Named("default") with org.apache.maven.api.di, no Sisu @Typed; the DI index is generated by the annotation processor (META-INF/maven/org.apache.maven.api.di.Inject lists the mojo factory and the executor).
    • Source roots: ProjectManager.getEnabledSourceRoots(project, scope, Language.JAVA_FAMILY); resources: the same call with Language.RESOURCES, turned into org.apache.maven.api.model.Resource. New helper exec/ProjectRoots.
    • Plugin dependency artifacts for license/config lookup (${plugin} PluginDescriptor.getArtifactMap() in v3): MojoExecution.getPlugin().getDependenciesMap() plus ArtifactManager.getPath(Dependency); proven by ITs MCHECKSTYLE-225-customHeader, -225-pluginManagement, -225-LICENSE.txt, -219-* (license read from a plugin-dependency jar).
    • Classpath for Checkstyle (project.getTestClasspathElements() in v3): Session.resolveDependencies(project, PathScope.TEST_COMPILE | MAIN_COMPILE) plus the output directories. A resolution failure logs a warning and continues with the output directories only (v3 with requiresDependencyResolution=NONE never failed here).

    plexus-resources without Sisu (how ResourceManager was obtained)
    DefaultCheckstyleExecutor and LicenseResourceManager no longer get ResourceManager/Map<String,ResourceLoader> injected. plexus-resources 1.4.0 is a Sisu component library but its classes are plain: javap of plexus-resources-1.4.0.jar shows DefaultResourceManager has public DefaultResourceManager(Map<String,ResourceLoader>) and FileResourceLoader, JarResourceLoader, URLResourceLoader, ThreadContextClasspathResourceLoader all have public no-arg constructors. Their @javax.inject.Named values (read from the class files) are file (FileResourceLoader.ID), jar, url, classloader. The executor builds new LinkedHashMap with those four and passes it to new DefaultResourceManager(map) or new LicenseResourceManager(map). The loaders keep search paths, so every executeCheckstyle call builds fresh instances (the v3 singleton managers were reconfigured on every call). No Lookup, no Sisu, no @Named("license") binding. LicenseResourceManager keeps its instanceof ThreadContextClasspathResourceLoader filter (MCHECKSTYLE-219), which works because the loader class is unchanged.

    User-visible changes

    • Version 3.6.1-SNAPSHOT β†’ 4.0.0-beta-1-SNAPSHOT; needs Maven 4.0.0-rc-7; Java 17.
    • Goals: check and help only. checkstyle:checkstyle and checkstyle:checkstyle-aggregate are gone until the reporting chain is ported; <reporting> entries and checkstyle:checkstyle checkstyle:check command lines break.
    • check parameters unchanged, except: resources and testResources (read-only, ${project.resources}) and the injected project/plugin parameters are no longer parameters; checkstyleRules is org.apache.maven.api.xml.XmlNode instead of PlexusConfiguration; threadSafe has no v4 attribute.
    • The mojo no longer fails the build with the MojoFailureException type: a violation failure and an execution failure are both MojoException (message unchanged; build result is FAILURE either way).
    • checkstyleRules inline config: Maven 4.0.0-rc-7 drops all attributes when it injects an XmlNode parameter (-X shows the configuration with <module name="Checker"> and (f) checkstyleRules = <module>... without name; inlinerules, MCHECKSTYLE-295, -371 fail with Attribute "name" is required ... for element type "module"). The mojo reads the node from MojoExecution.getConfiguration() instead, and writes it with XmlService.write (XmlNode.toString() is not XML). Consequence: ${...} expressions inside the inline rules are not evaluated (they were not with PlexusConfiguration either).
    • Checkstyle classpath now comes from an explicit dependency resolution, so check on a module whose dependencies cannot be resolved warns instead of silently using only the output directories.
    • Test infrastructure: maven-plugin-testing-harness 3.5.1 β†’ 4.0.0-beta-4, plus maven-impl, maven-core, maven-xml, Guice 6; test configs use ${project.basedir} (the harness does not evaluate ${basedir}); slf4j 1.7.36 β†’ 2.0.19; resolver test dependencies dropped.
    • ITs edited: MCHECKSTYLE-131, inlinerules, multi-modules, multimoduleproject ran clean checkstyle:checkstyle checkstyle:check; now clean checkstyle:check (check runs the analysis itself). Their assertions are unchanged and pass.

    Gaps

    • Report goals: see above. 19 ITs excluded in the run-its profile because they call checkstyle:checkstyle, site, or bind the checkstyle goal: MCHECKSTYLE-137, -172, -193, -222-no-resources, -222-resources, -222-testResources, -224, -253-jdk8, -332_cache-checker, -338, -357, -357-with-header-override, -365, -99, -99-custom-xref-test-location, checkstyle-goal, checkstyle-report, minimal-pom, multi-modules-aggregate. Not deleted; they pass again when the report goals return. Their failure on the ported plugin is Could not find goal 'checkstyle' in plugin ...:maven-checkstyle-plugin:4.0.0-beta-1-SNAPSHOT among available goals check, help.
    • XmlNode parameter injection loses attributes in Maven 4.0.0-rc-7 (workaround above; a core issue).
    • org.apache.maven.api.model.Resource is deprecated in rc-7 (javac warning) in favour of SourceRoot; kept because the executor request and addResourceFilesToProcess only need directory, includes and excludes.
    • No v4 equivalent of Plugin.getArtifactMap() for transitive plugin-realm artifacts; getDependenciesMap() covers the direct <dependencies> of the plugin, which is what v3 code looked up.

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-artifact, maven-plugin-annotations, javax.inject, org.eclipse.sisu.plexus, org.eclipse.sisu.inject, sisu-maven-plugin, animal-sniffer-maven-plugin (Java 8 signature), maven-reporting-api/-impl, doxia-core/-sink-api/-integration-tools and plexus-i18n from the plugin's own dependencies; resource managers are no longer singletons with shared search paths.

    Recommendation: do not merge. check is a usable starting point and keeps every check IT green on rc-7. Keep the plugin on 3.x until maven-site-plugin, maven-reporting-impl and doxia-sitetools have v4 releases in that order; then restore the four report classes (port MavenProject to Project, MavenReportException to the v4 report contract) and re-enable the 19 ITs. Separately worth filing against Maven core: the XmlNode attribute loss.

    maven-dependency-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17. 25 of 29 goals ship and run on Maven 4.0.0-rc-7; add, remove, list-repositories and analyze-report are not shipped.

    Rebased 2026-10-06 onto master. The tree goal now ports MDEP-969 (apache/maven-dependency-plugin#1712) and collects through DependencyResolver.collect, so it no longer uses the maven-dependency-tree 4.0.0-SNAPSHOT; the POM still declares that dependency. The verbose scope-selector fixes from #1712 and #1716 are not ported: they configure Resolver's ConflictResolver, which the Maven 4 API does not expose (see Gaps). MDEP-803 and MDEP-971 are carried. Unit tests: 177 run, 0 failed; ITs not rerun.

    Verified locally: mvn verify, Maven 4.0.0-rc-7, JDK 21. Unit tests before 435 run, 0 failed, 1 skipped; after 174 run, 0 failed, 0 skipped (accounting under Gaps). spotless:check, checkstyle, RAT, enforcer and the plugin's own analyze-only (strict) pass. ITs (-Prun-its -Dinvoker.test= subset, only ported goals, 30 min time-box): before, 75 builds, 74 passed, 1 failed (unpack-custom-ear, fails on the unchanged tree; purge-local-repository-bad-pom failed once and passed on rerun) in 1534 s; plus 19 more, 18 passed, 0 failed, 1 skipped (analyze-exclusions-gh-1598, the IT excludes Maven 4 itself) in 236 s. After, 94 builds: 85 passed, 8 failed, 1 skipped (582 s), then mdep-450-* rerun after a fix, 2 of 2 passed. The 8 failures: unpack-custom-ear (same as before), analyze-report, analyze-testDependencyWithNonTestScope, list-repositories (goals not shipped), tree-verbose, tree-verbose-small, used-dependencies, mdep-450-project-with-ancestor (fixed after that run). IT subset: analyze*, build-classpath*, collect, copy*, filterunpack, get-, mdep-4xx..9xx for ported goals, purge-local-repository, resolve*, go-offline*, tree*, unpack*, used-dependencies, dependency-properties, list-repositories, analyze-report. Not run: add-dependency, remove-dependency, setup-custom-ear-lifecycle.

    Shared snapshots consumed (built from the local branch agent/mvn4-api, commit "Port to the Maven 4 API"): maven-dependency-tree 4.0.0-SNAPSHOT a610f3b1ab9e01de142ae84b4363fcaa1db4ac50; maven-dependency-analyzer 2.0.0-SNAPSHOT f10337cef52a2366f4c46a685bef853a31d5484f; maven-common-artifact-filters 4.0.0-SNAPSHOT c2fdc406acfb36807bf1dd1f31eeecee510bb40f. Experiment only, not a dependency of the result: maven-reporting-impl 5.0.0-SNAPSHOT 21c3da415d7ebcf965f2dc1e1c101164220cdb74. plexus-archiver stays the released 4.14.0; its ArchiverManager is a Sisu component that a v4 mojo cannot have injected and the Lookup service does not find in the plugin realm, so UnpackUtil builds DefaultArchiverManager by hand from the UnArchiver entries of plexus-archiver's META-INF/sisu/javax.inject.Named (new compile dependency javax.inject:javax.inject:1 for Provider/Named).

    Per-goal table

    Goal Status Missing API / difference
    tree ported verbose output differs (dependency-tree 4 port has no premanaged/conflict data): "(scope not updated to compile)" lost, "scope updated from compile" added; tree-verbose ITs fail. Root node has no dependency, so include/exclude patterns are matched against the project in the mojo
    analyze, analyze-only ported params baseDir, outputDirectory removed (${basedir} does not evaluate). analyze forks via @Execute(phase="test-compile"); the forked build does not leave reactor siblings resolvable, so used-dependencies (multi-module) fails
    analyze-dep-mgt, analyze-duplicate, analyze-exclusions ported analyze-exclusions needs model InputLocation (present on Project.getModel()); only exercised by hand, its IT skips Maven 4
    analyze-report no run route port compiles against reporting-impl 5.0.0-SNAPSHOT (source changed, excluded from compile). Running: class org.apache.maven.execution.MavenSession not found in the v4 plugin realm; with maven-core added, "A type incompatibility occurred" (two copies of core classes). Reporting chain, not plugin code
    copy, copy-dependencies, unpack, unpack-dependencies ported BuildContext (m2e) gone: skipDuringIncrementalBuild accepted, no effect
    resolve, list, collect, resolve-sources, sources ported collect uses DependencyResolver.flatten (no download); "sources" classifier fixed at run time (no @Parameter on setters)
    build-classpath ported attach via ProjectManager
    get, list-classes, properties, display-ancestors ported relocation and POM download re-implemented (resolver no longer reads descriptors)
    purge-local-repository ported "launched from CLI" approximated by execution id default-cli; relocation/descriptor as above
    go-offline, resolve-plugins ported plugin <dependencies> scope and exclusions cannot reach the v4 request (resolved as compile, no exclusions)
    render-dependencies ported templates see a TemplateArtifact bean with the Maven 3 getters
    list-repositories no v4 route RemoteRepository has no mirrored-repositories or policy; IT expects "mirrored by" and "releases+snapshots"
    add, remove not ported need raw/original model and in-memory model update (syncInMemoryModel); not attempted, pom/DependencyEntry kept

    Public API changes

    • Every mojo implements org.apache.maven.api.plugin.Mojo, @Inject fields, unchecked MojoException; Maven 3 Artifact replaced by ResolvedDependency (new, path + coordinates) and api.Dependency; ResolverUtil, CopyUtil, UnpackUtil are plain classes, not components; ArtifactItem.getArtifact() returns DownloadedDependency; filters/markers/translators take Dependency; DependencyUtil gains getId, toString, getDependencyConflictId.

    Gaps

    • Resolver behaviours lost and rebuilt: POM download and relocation (Session.resolveArtifact), pre-order artifact order, Project.getParent() empty for repository parents, purge root-dependency scope semantics.
    • plugin-tools 4.0.0-beta-3 crashes on @Mojo(dependencyCollection = true), so requiresDependencyCollection is dropped; requiresDependencyResolution, threadSafe have no v4 attribute (resolved inside the mojo).
    • Tests: 435 to 174. Kept/ported: utils, filters, markers, translators, ArtifactItem, matchers, pruning visitor, ExclusionChecker, reactor filters, TestAnalyzeDepMgt (4 of 5; mojo() removed), ResolverUtilTest (22 to 18, descriptor/installer/collect cases rewritten for the v4 calls), pom/* (58, domtrip test scope); new ResolvedDependencyTest (4), TreeSerializationTest (5, replaces TestTreeMojo, whose mojo-discovery case is removed). Not compiled (files remain, excluded by testIncludes, Maven 3 harness with MavenProject/MavenSession stubs; ITs cover the goals): AddDependencyMojoTest 36, RemoveDependencyMojoTest 12, AnalyzeExclusionsMojoTest 9, GoOfflineMojoTest 9, ResolveDependenciesMojoTest 4, TestAnalyzeDuplicateMojo 2, TestBuildClasspathMojo 2, TestCollectMojo 3, TestCopyDependenciesMojo 35 + 2: 14, TestCopyMojo 29, TestGetMojo 8, TestIncludeExcludeUnpackDependenciesMojo 7, TestIncludeExcludeUnpackMojo 11, TestListClassesMojo 4, TestPropertiesMojo 2, TestRenderDependenciesMojo 2, TestResolveMojo 2, TestSkip 19, TestTreeMojo 6, TestUnpackDependenciesMojo 27 + 2: 5, TestUnpackMojo 17.

    User-visible changes

    • Runs on Maven 4 only, Java 17; 3.x line must stay for Maven 3. Goals add, remove, list-repositories, analyze-report absent. Parameters baseDir, outputDirectory (analyze) removed; skipDuringIncrementalBuild no-op; render-dependencies templates keep Maven 3 getters; tree verbose annotations differ; dependency:analyze on a multi-module reactor needs siblings already built (use analyze-only in the lifecycle).

    Improvements: drops maven-core, maven-plugin-api, maven-model, maven-artifact, maven-settings, maven-repository-metadata, maven-resolver-, plexus-build-api, sisu.plexus, plexus-i18n, maven-shared-utils, javax.inject annotations build; test side drops jetty and plugin-testing-harness. Adds maven-api-, three shared snapshots, javax.inject, slf4j-api (provided).

    Recommendation: ship the ported goals on the Maven 4 line, keep 3.x for Maven 3. Before a real PR: fix the dependency-tree verbose data, decide @Execute reactor behaviour upstream in Maven, file a plugin-tools issue for dependencyCollection, and port add/remove (route exists, unattempted).

  18. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Wave 4 findings, part 2 of 4: maven-doap-plugin to maven-jarsigner-plugin, then maven-site-plugin

    Each plugin is a local branch agent/mvn4-api with a "Build with Maven 4 only" commit and a "Port to the Maven 4 API" commit; the PRs are not opened yet.

    maven-doap-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17. Five approximations, all under Gaps; the release listing and the artifact parameter differ from Maven 3 behaviour in ways the unit tests cannot show.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 15 tests before and after, 0 failures, 0 skipped; mvn verify -Prun-its β†’ 4 of 4 ITs pass before and after; spotless:check clean. Smoke runs on rc-7 against Maven Central (scratch projects, not committed): a project whose releases exist on Central (release list, file-release URLs and created date came out right) and <artifact> set to org.apache.maven:maven-artifact:3.9.9 (parent inherited, URL and SCM effective). The pre-port plugin could not be compared on the same projects: under rc-7 it fails with NoClassDefFoundError: org/codehaus/plexus/util/xml/XmlStreamReader as soon as a repository returns metadata, which none of the ITs do.

    Public API changes

    • DoapMojo implements org.apache.maven.api.plugin.Mojo, @Mojo(name = "generate") from org.apache.maven.api.plugin.annotations; execute() throws MojoException. project is the injected org.apache.maven.api.Project, dates and model getters read from project.getModel().
    • Removed fields and read-only parameters: localRepository, projectBuildingRepositories, remoteRepositories, repositorySystemSession, settings, project (as a parameter).
    • DoapUtil.interpolate(String, Project, Settings) takes the v4 Project and org.apache.maven.api.settings.Settings. DoapUtil.getContributorsWith*Role(List<Contributor>) lose the I18N argument and use org.apache.maven.api.model.Contributor. ASFExtOptionsUtil.isASFProject(Project) and findChair/findPMCMembers take org.apache.maven.api.model.Developer.
    • Modello classes (DoapOptions, ASFExtOptions, ExtOptions, DoapArtifact) are unchanged.

    Gaps (rc-7 maven-api-core, maven-api-model, maven-api-settings)

    • Building a Project from coordinates: the v4 ProjectBuilder takes a path or a Source, not an artifact. <artifact> now resolves the POM with Session.resolveArtifact and builds from its path. A build from a Source (Sources.resolvedSource) returns an empty Optional<Project> with no problems listed, because DefaultSession.getProject drops a project without base directory; the plugin used it first and silently fell back to the current project. The request builder has no validation level, so Maven 3's VALIDATION_LEVEL_MINIMAL is gone.
    • RemoteRepository has no release or snapshot policy (getId, getType, getUrl, getProtocol only). The plugin picks the first repository that serves releases but not snapshots; it now reads the policies from the repository of the same id in project.getModel().getRepositories(). A repository that is not declared there, such as a mirror or one from settings.xml, is taken as releases only, which can change which repository is chosen.
    • No repository metadata service. Transport (from TransportProvider) fetches g/a/maven-metadata.xml by relative URI, and the XML is parsed with MetadataStaxReader, which ships in maven-support, not in an API module; it is bundled, as maven-jar-plugin does. Lost: the update and checksum policy, the local copy of the metadata, and the distinction resolver makes between a missing file and a failed transfer beyond Optional.empty().
    • Transport has no existence check. Whether a release file exists is now read from its .sha1, so a repository that serves artifacts without checksum files reports no file-release. The alternative was downloading every artifact of every version.
    • No repository layout service: Session.getPathForRemoteArtifact is the path in the local cache, not in the remote repository. The default-layout location is built by hand (g/a/v/a-v[-c].ext); the extension comes from session.requireType(type).getExtension(), or the type itself when unknown, as the old handler manager did.
    • ScmManager and I18N are Plexus components with no v4 injection. ScmManager is now a BasicScmManager holding only SvnExeScmProvider, the same provider set the old classpath had; I18N is replaced by ResourceBundle.getBundle("doap-person").
    • ${project.reporting.outputDirectory} is empty in Maven 4 unless the POM sets it (Maven 3 always gave ${project.build.directory}/site); the plugin applies that default itself. The basic IT caught it as an NPE.
    • Metadata.getVersioning().getVersions() is immutable; the old code reversed it in place. The unit fixture had one version, which hid the failure until the real run.
    • ProjectManager has no DI binding in rc-7; ProjectBuilder and TransportProvider are bound, but their implementations cannot be built in the test harness (DefaultTransportProvider needs resolver's TransporterProvider). All three are looked up with session.getService(...).
    • Interpolation: the project and pom prefixes now resolve against the effective Model (getter names match for name, url, scm.*, developers[n].*); basedir is added by hand. Anything that only MavenProject had (${project.artifact...}, ${project.file}) no longer resolves.
    • Test harness: maven-plugin-testing-harness 4.0.0-beta-4 has no real repository session (3.5.1 had realRepositorySession = true), so the two tests that resolved plexus-utils 1.5.5 and xstream 1.1 from Central now use fixture POMs (src/test/resources/unit/artifact, reduced by hand) and a mocked Session/ProjectBuilder, and the release tests use a directory-backed fake Transport. The real resolution path is covered only by the smoke run above, not by a committed test.

    User-visible changes

    • Needs Maven 4.0.0-rc-7 or newer and Java 17; <prerequisites> follows mavenVersion. The generate goal and its writable parameters keep their names.
    • Release listing: repository choice, existence check and metadata handling differ as described above.
    • <artifact> builds a model with Maven 4's default POM validation instead of minimal validation.
    • .github/workflows/maven-verify.yml still carries the JDK 8 / Maven 3.9.0 matrix-include entry, which cannot run a Maven 4 plugin; not touched.

    Improvements: drops maven-plugin-api, maven-core, maven-artifact, maven-settings, maven-model, maven-model-builder, maven-repository-metadata, maven-resolver-api/impl/spi, maven-scm-manager-plexus, plexus-i18n, javax.inject and the resolver test connectors; XmlStreamReader is no longer needed on the release path.

    Recommendation: port, and ask apache/maven for four things: a policy accessor on RemoteRepository, an existence check on Transport, a Metadata read service, and ProjectBuilder by coordinates that returns a Project for a repository POM. Until then a plugin that lists releases is the kind that loses most by moving. Release it as a 4.x line next to the 3.x one.

    maven-ear-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT (was 3.4.1-SNAPSHOT), Java 17.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify -> 48 unit tests before (8 classes) and 49 after, 0 failures/errors/skipped (one test added, see Tests). mvn verify -Prun-its -> before: 18/18 invoker ITs and 103/103 EarMojoIT pass (45 min, run with other builds in parallel); after: 17/18 invoker ITs pass and 103/103 EarMojoIT pass (13 min). The one failing IT is skinny-wars-timestamp (see Gaps); the before run is the 3.4.1 plugin under Maven 4. spotless:check clean. Released artifacts: maven-archiver 4.0.0-beta-5, maven-filtering 4.0.0-beta-1, plugin-tools 4.0.0-beta-1. Local snapshot consumed: maven-mapping 4.0.0-SNAPSHOT (agent/mvn4-api at 1f0a2fa, worktree wt-fbf-dep-mapping, mvn install -DskipTests).

    User-visible changes

    • Runs only on Maven 4 (no maven-plugin-api, maven-core, maven-artifact, javax.inject, maven-shared-utils). A 3.x line has to stay for Maven 3 builds.
    • Goals ear and generate-application-xml, their phases and every parameter name are unchanged; threadSafe is no longer declared (v4 @Mojo has no such attribute), nor requiresDependencyResolution (the plugin resolves PathScope.TEST_RUNTIME itself through DependencyResolver).
    • earSourceDirectory default is ${project.basedir}/src/main/application (${basedir} is not evaluated in v4, the directory was silently ignored), and the description default is ${project.model.description}.
    • @{version}@ (the default outputFileNameMapping) of a SNAPSHOT dependency expands to 1.0-SNAPSHOT, no longer to the timestamped 1.0-20150825.210557-91; the documented "timestamp postfix" in customize-file-name-mapping is not reproducible (see Gaps). EAR entry names and the Class-Path of skinny modules change accordingly for SNAPSHOT dependencies.
    • maven-mapping tokens (outputFileNameMapping): the documented ones (groupId, artifactId, version, baseVersion, dashClassifier?, extension) are unaffected. The v4 port drops the ArtifactHandler value source and api.Artifact has no type/scope; because the plugin passes the Dependency, @{type}@ now prints the Type object's toString() (not ejb) and @{scope}@ prints COMPILE (not compile), and @{packaging}@, @{language}@, @{file}@ stay literal in the file name. None of these is documented or used in the repo's poms/ITs.
    • Free-form parameters artifactTypeMappings, jboss, security, envEntries, ejbRefs, resourceRefs are XmlNode instead of PlexusConfiguration; the XML users write is unchanged.
    • Modules are still typed by the dependency type: Dependency.getType().id() is the declared string (ejb, war, rar, sar, har, par, wsr, app-client, ejb-client, test-jar, jboss-sar/-har/-par, custom types through artifactTypeMappings), so the type to module mapping works and is covered by 103 EarMojoIT projects. ejb, ejb-client, war, ear, test-jar are registered types in rc-7; the rest fall back to the legacy handler (extension = type) and resolve fine. The v4 Type replaces the ArtifactHandler for includesDependencies/extension only; the ear-specific mapping (EarModuleFactory, ArtifactTypeMappingService) stays in the plugin, nothing in v4 replaces it.
    • Public Java API: EarModule.getArtifact() returns the new util.ResolvedArtifact (dependency + resolved Path; v4 Dependency carries no file) instead of Artifact; module constructors, ArtifactRepository, EarExecutionContext follow; resolveArtifact no longer throws the checked MojoFailureException, InvalidJavaEEVersion extends the unchecked MojoException; ArtifactTypeMappingService.configure takes the new util.XmlConfig (a read-only view over XmlNode); EarMavenArchiver.getManifest takes api.Session/Project and the deprecated getManifest(MavenProject, config) overload is removed; EarMojo has no constructor (archivers are created inside; ArchiverManager replaced by new ZipUnArchiver()).
    • New Providers (@Provides ProjectManager, BuildContext) for MavenFileFilter; the ear artifact is attached with ProjectManager.attachArtifact(project, project.getMainArtifact(), ear) or a produced artifact of type ear for a classifier.

    Gaps

    • skinny-wars-timestamp IT fails (only after-failure): v4 gives the resolved SNAPSHOT Dependency version 1.0-SNAPSHOT and a -SNAPSHOT local-repo file name; session.resolveArtifact returns the same. The timestamped version is unreachable through the API, so the IT's expectations (eartest-jar-sample-one-1.0-20150825.210557-91.jar in Class-Path, timestamped jar removed from the WAR built by the 3.x war plugin) cannot hold. With a v4 war plugin both sides use -SNAPSHOT and the original-file-name lookup matches; only mixed 3.x-war/4.x-ear builds leave the duplicate jar in WEB-INF/lib. IT left red on purpose, not edited.
    • DependencyResolver ignores Type.isIncludesDependencies() (war, ear, rar) although the session has FatArtifactTraverser: the war's transitives appear in the result, and an artifact reachable by several paths is listed only below the nearest one (skinny-wars-javaee5 and project-089..096 failed with it). Worked around in AbstractEarMojo.resolveProjectArtifacts: a RESOLVE tree plus a verbose COLLECT tree; an artifact is kept only if reachable without passing through an includesDependencies node (a reachable winner's subtree counts). Approximation: a version conflict won by the fat path is not re-mediated.
    • XmlNode mojo parameters lose XML attributes (DefaultBeanConfigurator.XmlConverter builds the node with null attributes; same on core master): artifactTypeMapping type= mapping=, security-role id, loader-repository class. Worked around by reading those elements from the injected MojoExecution.getConfiguration() (model XmlNode, attributes intact); values are model-interpolated only, ${session.*}-style expressions are not evaluated. PlexusConfiguration parameters cannot work at all ("Cannot create instance of interface"): core does not export org.codehaus.plexus.configuration to plugin realms, @Mojo(configurator = "basic") does not help.
    • Session has no build start time; deleteOutdatedResources uses the JVM start time, so under a long-lived JVM (mvnd) stale files from an earlier build in the same daemon are not deleted.
    • Mojo failure vs error is lost (MojoException only), so MojoFailureException paths (unknown artifact, missing candidate) now report as errors.
    • META-INF/plexus/components.xml (ear ArtifactHandler and LifecycleMapping) is kept untouched and not exercised: Maven 4 core has built-in ear type and ear lifecycle mapping (EarLifecycleMappingProvider), which the ITs use; a plugin-provided packaging needs the Plexus components in rc-7.
    • System-scope dependencies: PathScope.TEST_RUNTIME has no SYSTEM scope in rc-7, so they are not part of the module set; not covered by any IT.

    Tests: all 48 unit tests kept. AbstractEarTestBase builds ResolvedArtifact over a new stub/DependencyStub (implements api.Dependency); removed stub/ArtifactHandlerTestStub (v3 ArtifactHandler, unused now). ArtifactTypeMappingServiceTest builds XmlNode instead of XmlPlexusConfiguration; its testConfigWithSameCustomType never populated the second mapping (it set the attributes on the first element twice), so it only exercised the missing-attribute path: kept as is and testConfigWithSameCustomTypeRegisteredTwice added for the real duplicate (49 tests). AbstractEarPluginIT uses plexus-utils FileUtils. No IT source changed.

    Improvements: drops maven-plugin-api, maven-core, maven-artifact, maven-plugin-annotations, javax.inject, maven-shared-utils; adds maven-api-core/di/annotations/model/xml (provided), plexus-build-api and org.eclipse.sisu.plexus (needed at runtime by ThreadBuildContext, AbstractLogEnabled; dependency:analyze ignore entry added).

    Recommendation: not mergeable as is. Port for Maven 4 and keep a 3.x line, but only after the core gaps are filed: includesDependencies not honoured by the API resolver, XmlNode parameter conversion dropping attributes, no snapshot timestamp version and no session start time in the API. The ear plugin itself ports with workarounds that restore behaviour for all 103 EarMojoIT cases and 17 of 18 invoker ITs; skinny-wars-timestamp is the one documented behaviour that cannot be kept.

    maven-ejb-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT (was 3.3.1-SNAPSHOT), Java 17.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify β†’ 36 tests before (19 EjbMojoTest, 10 EjbHelperTest, 7 IncludesExcludesTest) and 36 after, 0 failures/errors/skipped. mvn verify -Prun-its β†’ 9/9 invoker ITs pass before (4m58s) and after; spotless:check clean. Released artifacts only, no local snapshots: maven-archiver 4.0.0-beta-5, maven-filtering 4.0.0-beta-1, maven-plugin-plugin 4.0.0-beta-1, maven-testing 4.0.0-rc-7.

    User-visible changes

    • Runs only on Maven 4 (no javax.inject, maven-plugin-api, maven-core, maven-artifact, maven-model, maven-settings, sisu annotations). A 3.x line has to stay for Maven 3 builds.
    • Goal ejb, phase package and every parameter (classifier, clientClassifier, ejbJar, ejbVersion, generateClient, clientIncludes/Excludes, excludes, archive, filtering options, outputTimestamp) are unchanged; threadSafe is no longer declared (v4 @Mojo has no such attribute).
    • Public API: EjbMojo.getProject() now returns org.apache.maven.api.Project (was MavenProject); validateEjbVersion throws the unchecked MojoException (was checked MojoExecutionException). EjbHelper is unchanged.
    • Main jar is attached via ProjectManager.attachArtifact(project, project.getMainArtifact(), path); classified jar and client jar via session.createProducedArtifact(..., type "ejb" / "ejb-client"). The old unreachable FIXME branch for a null client classifier did the same call as the valid branch and is merged into it.
    • Maven 4 prints the "You have to use a classifier ..." failure without the trailing -> [Help 1], so the IT mejb-93 now matches the message without it (it still asserts the same behaviour: a second execution without classifier fails).
    • New Providers class (@Provides) supplies ProjectManager and BuildContext (required by DefaultMavenFileFilter 4.0.0-beta-1).

    Gaps

    • org.eclipse.sisu:org.eclipse.sisu.plexus must be a compile dependency: ThreadBuildContext (plexus-build-api 0.0.7) extends org.codehaus.plexus.logging.AbstractLogEnabled, which a v4 plugin realm does not provide. Without it all 7 ITs failed with NoClassDefFoundError: org/codehaus/plexus/logging/AbstractLogEnabled. maven-resources-plugin master carries the same dependency.
    • @Mojo(requiresDependencyResolution = RUNTIME) has no usable v4 equivalent with maven-plugin-plugin 4.0.0-beta-1 (dependencyResolutionPathScopes fails descriptor generation: "Method: 'dependencyResolutionPathScopes' not found in class MojoAnnotationContent"). Dropped; MavenArchiver.getManifest resolves MAIN_RUNTIME itself through DependencyResolver, and the manifest-content IT passes.
    • The v3 harness (AbstractMojoTestCase, MavenProject stubs) has no v4 counterpart.

    Tests: EjbMojoTest rewritten on JUnit 5 with maven-testing (ProjectStub, SessionMock), @TempDir and a mocked ProjectManager; all 18 original scenarios kept with the same assertions, one lookup test moved to @MojoTest/@InjectMojo (resource renamed plugin-config.xml to pom.xml), and two attach assertions added (verify on ProjectManager/Session for the default and classified+client cases). Removed and replaced: stub/MavenProjectBasicStub, MavenProjectBuildStub, MavenProjectResourcesStub, ModelStub (v3 MavenProject subclasses; replaced by the nested TestProject). vintage-engine and maven-plugin-testing-harness 3.5.1 dropped. EjbMojo fields are set by reflection in these tests, as before.

    Improvements: drops javax.inject, maven-plugin-api, maven-core, maven-artifact, maven-model, maven-settings, maven-shared-utils, plexus-utils, org.eclipse.sisu.inject, JUnit vintage, the v3 testing harness.

    Recommendation: port for Maven 4; keep a 3.x line for Maven 3 users. maven-ear-plugin's pom only lists maven-ejb-plugin as an extraArtifact for its ITs (mavenEjbPluginVersion), so it is not a compile-time consumer; its ITs that resolve the ejb plugin would need a 4.x version together with Maven 4.

    maven-gpg-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17. All three goals (sign, sign-and-deploy-file, sign-deployed) ported and exercised by the ITs; one behaviour cannot be ported with the API (encrypted settings passphrases, see Gaps). No test or IT removed.

    Rebased 2026-10-06 onto master with apache/maven-gpg-plugin#346. The port removes the settings parameter that #346 deprecates. Unit tests: 10 run, 0 failed, 1 skipped.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn -B -ntp verify: 10 tests, 0 failures, 1 skipped (BcSignerTest 6, GpgVersionTest 3, GpgVersionConsumerTest 1), before and after. -Prun-its with the Bouncy Castle signer (bc-integration-tests plus failsafe Bc*IT): invoker 13 of 13 passed and BcSignArtifactIT 4 of 4, before and after. The gpg-integration-tests execution and GpgSignArtifactIT could not be measured: the system gpg 2.5 fails with "can't connect to the gpg-agent: File name too long" (macOS socket path limit; the worktree path is too long), which gave 1 of 13 before, so for the comparison that execution was switched off in a scratch copy of the pom in both runs. The gpg signer path is therefore not exercised after the port beyond compilation. Spotless clean.

    v4 routes

    • Attach: MavenProjectHelper.attachArtifact(project, type, classifier, file) becomes ProjectManager.attachArtifact(Project, ProducedArtifact, Path) with session.createProducedArtifact(g, a, v, classifier, extension + ".asc", null) (the 6-argument factory, because the short attachArtifact overloads cannot carry a classifier). FilesCollector reads ProjectManager.getPath/getAttachedArtifacts and ArtifactManager.getPath.
    • sign-and-deploy-file outside a project: yes. Same shape as maven-deploy-plugin 4.0.0-beta-3 DeployFileMojo (projectRequired = false): artifacts from session.createProducedArtifact, paths via ArtifactManager.setPath, deploy via ArtifactDeployer with ArtifactDeployerRequest (its retryFailedDeploymentCount replaces the hand-written retry loop), repository from session.createRemoteRepository(id, url), POM read/generated with ModelXmlFactory. Signing itself has no API and stays in GpgSigner/BcSigner.
    • sign-deployed: session.withLocalRepository(session.createLocalRepository(tmp)) for the private repo, resolveArtifacts(coordinates, repos), ArtifactDeployer for the .asc files.

    Public API changes

    • Mojos implement org.apache.maven.api.plugin.Mojo; MojoExecutionException/MojoFailureException become the unchecked MojoException in all public signatures (AbstractGpgSigner, GpgSigner, BcSigner, GpgVersionParser, FilesCollector).
    • BcSigner(Session, ...) and its Loader methods take org.apache.maven.api.Session instead of the aether session; FilesCollector(Session, Project, String[], Log) (was MavenProject, String[], Log); AbstractGpgMojo.getPassphrase(Project).
    • ArtifactCollectorSPI.collectArtifacts(Session, RemoteRepository) now uses org.apache.maven.api.Artifact/RemoteRepository/Session: an SPI break for any implementor.
    • The settings parameter (${settings}) and the injected SettingsDecrypter are gone; session.getSettings() is used.
    • Env variables (env.MAVEN_GPG_*) are read from the session user then system properties (BcSigner.getEnv), replacing RepositorySystemSession.getConfigProperties().

    Gaps

    • Encrypted passphrases in settings.xml: rc-7 has no decrypt service in any maven-api-* module (SettingsDecrypter exists only in compat maven-settings-builder, and maven-impl never calls it). gpg.passphraseServerId values that look encrypted ({...}) now fail with an explicit MojoException instead of being signed with as cipher text; plain passphrases still work (IT sign-with-passphase-from-maven-settings passes). Needs a settings-decrypt service in maven-api-core to be closed.
    • The "old way" passphrase-from-project-properties read no longer copies the found value onto the reactor root project (Project.getModel().getProperties() is immutable).
    • ModelValidator strict validation of the coordinates in sign-and-deploy-file has no API equivalent; replaced by a local check (groupId/artifactId [A-Za-z0-9_.-]+, version without path or whitespace characters, packaging non-blank), which is looser than the model validator.
    • ArtifactHandlerManager replaced by TypeRegistry.lookup(packaging); unknown types fall back to extension = type, as before.
    • Mojo constructor injection does not work with the generated MojoFactory (NoSuchMethodError: SignDeployedMojo.<init>()): SignDeployedMojo uses field injection, @Inject @Nullable Map<String, ArtifactCollectorSPI> (an empty map otherwise fails to inject).
    • BcSignerTest built an aether session with maven-resolver-impl; it now uses a java.lang.reflect.Proxy over Session that answers only the two property maps (no new test dependency, which would need a pgpverify keys-map entry).
    • <proc>none</proc> removed from the compiler configuration so the api.di index is generated.
    • plexus-utils (FileUtils, SelectorUtils, Os, cli.*, CachingOutputStream) is not a Maven API and stays.

    User-visible changes

    • Requires Maven 4; Java 17; <prerequisites> follows mavenVersion.
    • Failure text MojoFailureException: Do not store passphrase... is now MojoException: ... (IT sign-release-best-practices-fail updated).
    • Encrypted server passphrase: explicit failure, see Gaps. retryFailedDeploymentCount log lines ("Retrying deployment attempt") no longer come from the plugin.
    • maven-resolver-impl test dependency and the resolverVersion property removed.

    Improvements: drops maven-core, maven-plugin-api, maven-artifact, maven-model, maven-model-builder, maven-settings, maven-settings-builder, maven-resolver-api/util, maven-plugin-annotations, javax.inject.

    Recommendation: port is viable; do not merge until the settings-decrypt gap is decided (file against apache/maven), and run the gpg signer ITs on a machine with a short checkout path.

    maven-help-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT (was 3.5.3-SNAPSHOT), Java 17. Two goals are degraded, see Gaps.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify before β†’ 30 tests, 0 failed, 0 skipped; after β†’ 61 tests, 0 failed, 0 skipped. mvn verify -Prun-its before β†’ 34 passed, 0 failed, 2 skipped (12m27s); after β†’ 36 passed, 0 failed, 0 skipped (18m03s, run on a copy of the tree); describe-cmd-with-goal-report failed on its first attempt (the report check logged Couldn't identify if this goal is a report goal: org/apache/maven/plugin/AbstractMojo, cause not isolated) and passed on the invoker retry. spotless:check clean. No local snapshots consumed, released artifacts only.

    User-visible changes

    • All 11 goals are org.apache.maven.api.plugin.Mojos; session, project, Log and the services are @Injected. Goal names, phases and parameter names/properties are unchanged; output is now a Path (same XML syntax). The plugin no longer loads under Maven 3: a 3.x line has to stay.
    • evaluate: the expression evaluator of Maven 3 is gone. The new one (ExpressionEvaluator) handles project, session, settings, mojo, plugin, localRepository, reactorProjects, basedir, rootDirectory, env.X, then project properties, session properties and system properties, through the public getters of the API objects (a.b.c, list[0], map(key)). ${project.x} falls back to the model when Project has no getter, so project.name and project.properties work. Objects that are not a model, settings or scalar are written by XmlRenderer (bean, list, map), not by XStream, so the element order of such output is alphabetical instead of field order. Interactive mode uses the Prompter service instead of InputHandler.
    • effective-pom: properties are written sorted (the IT effective-pom_properties expected the reversed hash order of Maven 4 with the old plugin; it now expects the sorted order on every Maven version). Verbose location comments go through XmlWriterRequest.inputLocationFormatter.
    • active-profiles: the source of a POM profile is the g:a:v of the POM in the parent chain that declares it (from getDeclaredActiveProfiles), settings profiles are listed once as external. The ITs active-profiles and active-profiles_multimodule pass.
    • list-lifecycle-phases, describe -Dcmd=<phase>: phases are the Maven 4 ones (before:compile, after:resources, ...). describe -Dcmd=process-resources still works through Lifecycle.aliases().
    • list-packaging, list-dependency-types: only the ids Maven itself defines are listed (see Gaps).
    • describe: plugin groupId:artifactId[:version] works through the plugin jar and its META-INF/maven/plugin.xml; -Dplugin=<prefix> and -Dcmd=<prefix>:<goal> work for the plugins of the project and for maven-<prefix>-plugin / <prefix>-maven-plugin in the plugin groups of settings, org.apache.maven.plugins and org.codehaus.mojo.
    • The two ITs evaluate-model-collections and evaluate-settings-servers were skipped on Maven 4 (invoker.maven.version = 4-, XStream could not serialise immutable maps); they now run and pass, the skip line is removed.

    Gaps

    • No v4 route, goal describe only: plugin prefix resolution from the repositories' group metadata (MojoDescriptorCreator.findPluginForPrefix, PluginPrefixResolver). The prefix heuristic above cannot find a plugin with a non-conventional artifactId that the project does not declare. No plugin version resolver either: a missing version is the one of the project's build/plugins or pluginManagement, else the highest non-snapshot of the version range. Relocations of the plugin POM are not followed (ArtifactResolver does not read the descriptor).
    • No v4 route, goals list-packaging and list-dependency-types: PackagingRegistry and TypeRegistry only look up by id (ExtensibleEnumRegistry has no listing), and the legacy handlers come from Sisu components. The goals probe the constants of org.apache.maven.api.Type plus ejb, ejb-client, war, ear, rar, par, sources, test-sources, and the packagings pom, jar, maven-plugin, ejb, ejb3, war, ear, rar. A packaging or type that a third-party extension registers is not listed.
    • describe with a plugin whose POM Maven 4 rejects (the IT uses maven-help-plugin:2.0): ProjectBuilderRequest has no validation level, so the name is read from the POM file and the report-goal check falls back to the runtime dependencies.
    • v4 MojoDescriptor/Parameter drop the <configuration> element of a Maven 3 plugin.xml (default value, expression). describe reads it with its own DOM pass so that "Default" and "User property" still show for Maven 3 plugins.
    • evaluate cannot evaluate what Maven 3 evaluated through PluginParameterExpressionEvaluator and the session internals: anything that is not reachable through a public getter or method of the API objects (for example the plugin context). Unmeasured beyond the expressions in the ITs and ExpressionEvaluatorTest.
    • active-profiles: Maven 4 gives no per-model activation record, only getDeclaredActiveProfiles() per project, so the source is the POM in the parent chain that declares the active profile.

    Tests: AbstractHelpMojoTest now tests parseCoordinates (same four cases); in DescribeMojoTest the three lookup tests that mocked MojoDescriptorCreator/PluginVersionResolver/MavenPluginManager are replaced by lookups on a generated plugin jar (prefix with and without version, GAV); the describeCommand tests run on mocked LifecycleRegistry/Packaging. No test was deleted; new: EffectivePomMojoTest, EffectiveSettingsMojoTest, ExpressionEvaluatorTest, ListMojosTest.

    Improvements: drops maven-artifact, maven-core, maven-model, maven-model-builder, maven-plugin-api, maven-settings, maven-resolver-api, javax.inject, org.eclipse.sisu.plexus, maven-plugin-annotations, maven-shared-utils, plexus-interactivity-api and xstream. plexus-utils (needed at runtime by HtmlToPlainTextConverter, whose own dependencies are excluded), plexus-xml, jdom2, maven-reporting-api 4.0.0 (only the MavenReport type check) and maven-plugin-tools-generators stay. Adds maven-api-core/di/annotations and maven-xml (provided).

    Recommendation: port for Maven 4 and keep a 3.x line for Maven 3. Upstream follow-ups worth filing: a listing method on ExtensibleEnumRegistry; a plugin-prefix and plugin-version resolution service in the API; MojoDescriptor keeping the v3 <configuration> defaults; a validation-level option on ProjectBuilderRequest; a public expression evaluator for plugins.

    maven-invoker-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Rebased 2026-10-06 onto master with apache/maven-invoker-plugin#760, and its script bytecode-level resolution ported to Session. Unit tests: 73 run, 0 failed (67 before); ITs not run, including #760's new IT.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 67 unit tests before and after, 0 failures, 0 skipped; spotless clean. -Prun-its (92 IT projects): before, the 30 min time-box hit after 45 ITs (all 45 passed, none failed); after, the same 45 ITs ran in 1770 s and all pass (44 at first, staging-pom after the fix below), plus 26 more selected by the code they touch (-Dinvoker.test= list of settings-, script-, local-repo-, staging-, install-, invoker-report, ...): 24 pass, 2 fail (MINVOKER-377-install-ignore-split-repo, invoker-report, see Gaps). Not run, before or after: 22 ITs (MINVOKER-196, -288-failed-setup-verify, -289, -294, -330, exec-timeout-mojo-level, fail-build-with-verify, fail-ignore*, fail-noprojects_verify, invocation-cmdline-exclude, invocation-debug, invocation-group-properties, invocation-reactor-indirect, invocation-spaces, multiple-pre-post-build, project-cloning-reactor, rerun-build, rerun-build-invoker-test-in-config, script-streamLogs-false). Not measured: running the ported plugin under Maven 3; heavy machine load (load average >100) makes the IT timings unreliable.

    Uses maven-api-core/-di/-annotations/-model/-settings 4.0.0-rc-7 (provided), plugin-tools 4.0.0-beta-3, and the local snapshots maven-reporting-api and maven-reporting-impl 5.0.0-SNAPSHOT (agent/mvn4-api branch of reporting-impl, already in the local repository, not rebuilt here). maven-invoker 3.3.0 and maven-script-interpreter 1.9 use no Maven API and are unchanged.

    v4 route for install into an alternate local repository (invoker:install): Session.withLocalRepository(session.createLocalRepository(path)) gives a session bound to the staging repo; DependencyResolver.resolve(DependencyResolverRequest{project|root dependency, PathScope}) returns getDependencies() (Dependency to Path) for the transitive closure; POMs and their parent chains come from session.resolveArtifact(createArtifactCoordinates(g, a, v, "pom"), repos); ProjectManager.getRemoteProjectRepositories/getRemotePluginRepositories supply the repositories; altSession.installArtifacts(...) writes them. Scope runtime/compile/test maps to PathScope.MAIN_RUNTIME/MAIN_COMPILE/TEST_RUNTIME. Two traps, both hit by ITs:

    • Session.setArtifactPath(ProducedArtifact, Path) rewrites the file of every reactor project artifact with the same id and throws UnsupportedOperationException: transformed artifact file cannot be set for the project's own (transformed) POM. Reactor artifacts must be installed as they are (Project.getArtifacts() + ProjectManager.getAttachedArtifacts(), the file travels inside the artifact); setArtifactPath only for downloaded ones.
    • Project.getParent() returns only reactor parents, unlike MavenProject.getParent(); the parent chain has to be walked through project.getModel().getParent() and resolved (IT staging-pom caught it).

    Script-visible bindings (ScriptRunner globals, maven-script-interpreter): none of them carries a Maven type, so no binding changes type. basedir (script dir, File), context, scriptFile, logger, localRepositoryPath (File), mavenVersion (String) and scriptVariables are as before. Value changes: localRepositoryPath default is now session.getLocalRepository().getPath() (follows -Dmaven.repo.local; was ${settings.localRepository}); mavenVersion with no mavenHome is session.getMavenVersion(). What does change is the script class path: scripts used to see the Maven 3 plugin realm, so org.apache.maven.plugin.MojoExecutionException (IT settings-merge/postbuild.groovy, now throws IllegalStateException), MavenProject and friends resolved; in a v4 plugin realm they do not (unable to resolve class org.apache.maven.plugin.MojoExecutionException). With addTestClassPath the test class path is resolved by session.resolveDependencies(project, PathScope.TEST_RUNTIME) plus the project's test and main output directories, minus the plugin's own artifact and dependencies.

    Public API changes

    • Plugin runs on Maven 4 only (v4 Mojo, @Inject, @Mojo(defaultPhase = "...")); all mojos throw the unchecked MojoException. MojoFailureException (BUILD FAILURE) and MojoExecutionException (error) are no longer distinguishable.
    • Goals install, run, integration-test, verify, report and their parameters keep names and properties. requiresDependencyResolution = TEST and threadSafe = true are gone (no v4 attribute); install and run resolve what they need themselves.
    • Defaults that changed: localRepositoryPath (install and run) has no expression default; it falls back to the session's local repository. projectsDirectory default is ${project.basedir}/src/it/ because ${basedir} is not evaluated in v4 (it stays literal and run then reports "No projects were selected"). invoker.install.scope also accepts the v4 path scope ids.
    • AbstractInvokerMojo/InstallMojo constructors are gone (Invoker, SettingsBuilder, ToolchainManager, MavenProject, MavenSession are no longer injected; DefaultInvoker is instantiated, v4 services come from session.getService). InvokerReport no longer takes an I18N; it reads the invoker-report bundle directly.
    • Interpolation (CompositeMap) now reads project.*/pom.* from the effective Model (plus basedir, file): expressions that hit MavenProject-only getters (project.artifact, project.file as File, project.compileSourceRoots) no longer resolve.
    • mergeUserSettings: the merge is hand-written (mergeSettings in AbstractInvokerMojo), dominant entries win by id, because the v4 API has no SettingsUtils.merge; the MINVOKER-133 sourceLevelSet reset has no counterpart (immutable settings model).
    • POM scanning also follows <subprojects>, which v3 could not read (not exercised by an IT).

    Gaps

    • invoker:install cannot pin the resolver config of the staging repository. The v3 code cloned the repository session with aether.enhancedLocalRepository.split=false (MINVOKER-377); Session.withLocalRepository inherits the outer build's config and offers no way to override it. IT MINVOKER-377-install-ignore-split-repo fails (artifacts land under installed/, not the flat path). Not worked around: copying files and writing maven-metadata-local.xml by hand would be inventing an installer. The forked builds still get -Daether.enhancedLocalRepository.split=false, so run is unaffected.
    • Report goal: blocked. It compiles against the local v4 AbstractMavenReport (reporting-impl 5.0.0-SNAPSHOT) but cannot run. Standalone, mvn org.apache.maven.plugins:maven-invoker-plugin:4.0.0-beta-1-SNAPSHOT:report fails with A required class was missing ... report: org/apache/maven/execution/MavenSession (NoClassDefFoundError at LegacyMavenBridge.<init> from AbstractMavenReport.getSiteTool, because the doxia-tools/site-tool side still needs maven-core classes that a v4 plugin realm does not have). Through mvn site, maven-site-plugin 3.22.0 fails with Failed to get report for org.apache.maven.plugins:maven-invoker-plugin: Unable to lookup Mojo: Cannot cast org.apache.maven.plugins.invoker.InvokerReportFactory to org.apache.maven.plugin.Mojo (IT invoker-report). Needs doxia-sitetools, site plugin and reporting-exec on v4 first.
    • No v4 Mojo/Plugin API for "the plugin realm's artifacts" (plugin.artifacts): approximated with MojoExecution.getPlugin().getArtifact()/getDependencies() and Session.getArtifactPath.
    • v4 dependency resolution omits the project's own output directories, added by hand for addTestClassPath.
    • No removed tests; test changes: mocks of MavenProject/MavenSession/Settings replaced by mocks of Project/Session/Settings, constructors without arguments, InterpolatorUtils takes a Map. IT settings-merge script changed as above.

    User-visible changes

    • Maven 3 users stay on 3.x; the 4.x line needs Maven 4.
    • IT scripts (Groovy/BeanShell) and invoker.properties keep working unless they touch Maven 3 API classes (see bindings); ${project.*} filtering keeps working for model properties.
    • invoker:report/site integration does not work on the 4.x line yet; invoker:verify and the invoker-reports XML are unchanged.
    • Split local repository layouts of the invoking build are not neutralised by invoker:install (MINVOKER-377 regression).

    Improvements: drops maven-core, maven-model, maven-plugin-api, maven-artifact, maven-settings, maven-settings-builder, maven-resolver-api/-util, maven-plugin-annotations, javax.inject, plexus-i18n and sisu-maven-plugin; the install logic no longer talks to RepositorySystem/RepositoryUtils/ProjectArtifact. <prerequisites><maven> follows ${mavenVersion}.

    Recommendation: port the run, install and verify goals as a 4.x line once MINVOKER-377 has an answer (a Session-level way to set resolver config, or a documented flat-layout install); keep the report goal on 3.x until the reporting chain is on v4 (then only InvokerReport and the renderer need touching). Scope: the 22 unrun ITs should be run before any merge.

    maven-jarsigner-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 51 tests before, 52 after (one added for the proxy path), 0 failures, 0 skipped; mvn verify -Prun-its β†’ 9 of 9 ITs pass before and after; spotless:check clean. Smoke runs outside the ITs on rc-7 (scratch project, not committed): toolchain selected through maven-toolchains-plugin 3.2.0, active proxy passed to jarsigner (offline run), storepass/keypass encrypted in the legacy {...} form with a settings-security.xml master password. Not exercised: the new-format settings-security4.xml, the gpg-agent, pinentry-prompt and system-property master sources, Windows.

    Public API changes

    • AbstractJarsignerMojo implements org.apache.maven.api.plugin.Mojo instead of extending AbstractMojo; execute() and the protected hooks throw MojoException instead of MojoExecutionException. The protected constructor taking JarSigner, ToolchainManager and SecDispatcher is gone; the mojos get a DefaultJarSigner and their services injected.
    • @Parameter types File β†’ Path for archive, archiveDirectory, workingDirectory and certchain. project, settings and session are no longer parameters.
    • getLog() returns org.apache.maven.api.plugin.Log.
    • New public ToolchainAdapter (see Gaps), package-private SecDispatchers; META-INF/plexus/components.xml deleted.
    • maven-jarsigner 3.1.0 is unchanged. It uses no Maven API, so it needed no port.

    Gaps

    • No service to decrypt a configuration value. The plugin decrypts storepass and keypass itself, and Maven's own decryptor is wired inside maven-impl (DefaultSettingsBuilder), not reachable from a plugin. SecDispatchers rebuilds it as ApiRunner$SecDispatcherBindings does, from internal classes of plexus-sec-dispatcher 4.2.0 (AESGCMNoPadding, MasterDispatcher, LegacyDispatcher, DefaultSecDispatcher), reading ${user.home}/.m2/settings-security4.xml. That is a copy of Maven's wiring and will drift from it.
    • Correction to the premise: the plugin reads no passwords from Settings, only the active proxy host, port and nonProxyHosts. For settings passwords the v4 route is Session.getSettings(): maven-impl wraps settings in a DecryptingSettingsTransformer for server and proxy passwords (seen in bytecode, not executed here).
    • Settings has no getActiveProxy(); the plugin takes the first Proxy with isActive().
    • ProjectManager has no DI binding in rc-7 (No binding to construct an instance for key ProjectManager; ArtifactManager, ToolchainManager, Session, Project, Log do bind). The plugin uses session.getService(ProjectManager.class).
    • Toolchains silently stop working if the v4 toolchain is handed over as is: maven-shared-utils calls findTool(String) reflectively on the object's class, which is the non-public DefaultJavaToolchainFactory$DefaultJavaToolchain, so it logs unexpected IllegalAccessException at WARN and runs the JDK that runs Maven. ToolchainAdapter is a public wrapper for that call. A plugin on any maven-shared-utils JavaTool (jmod, jlink, jdeps, jdeprscan) has the same trap.
    • @Mojo has no threadSafe attribute; sign keeps its own threadCount executor.
    • The v4 plugin.xml lists every parameter with <defaultValue> and has no <configuration> block; the test helper PluginXmlParser reads the new layout. An unset String[] parameter (tsa, tsacert, tsapolicyid) arrives as an empty array, as the basic IT shows.

    User-visible changes

    • Needs Maven 4.0.0-rc-7 or newer and Java 17; the <prerequisites> follows mavenVersion. The plugin no longer loads under Maven 3.
    • No goal or parameter name changes. Old-format encrypted passwords keep working through the legacy dispatcher.
    • Runtime dependencies: plexus-sec-dispatcher goes from org.sonatype.plexus:1.4 to org.codehaus.plexus:4.2.0, both bundled.

    Improvements: drops maven-plugin-api, maven-core, maven-artifact, maven-settings, maven-plugin-annotations, javax.inject and the Plexus component descriptor.

    Recommendation: port once the gaps are in the open: a decrypt service in the API, ProjectManager bindable, and a public toolchain type or findTool hook in maven-shared-utils. Release it as a separate 4.x line; the 3.x line keeps serving Maven 3.

    maven-site-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17. Every goal is a Maven 4 API mojo and runs in a real Maven 4.0.0-rc-7 build; the plugin cannot generate reports, because the Maven 4 API has no way to run another plugin's mojo (see "What the Maven 4 API must add for reports").

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn verify before β†’ 12 tests, 0 failures; after β†’ 12 tests, 0 failures. -Prun-its (whole suite, no time-box hit): before β†’ 62 of 62 ITs pass (5:29 min); after β†’ 40 of 62 pass (4:27 min). The 22 that fail all verify report output: their target/site trees differ from the before-run only by missing report pages (project-info.html, project-reports.html, surefire.html, dependencies.html, checkstyle.html, javadoc pages, ...), with no extra and no missing handwritten page, and each build ends in BUILD SUCCESS with the warning below (failure expects its first builds to fail on a failing report plugin and gets exit code 0). spotless:check clean. Not run in CI. site:run has no IT; smoke-tested by hand (200 for a rendered markdown page, 404 for a missing one).

    Snapshots consumed: doxia-integration-tools, doxia-site-renderer, doxia-site-model 3.0.0-SNAPSHOT from the local port branch agent/mvn4-api (worktree, mvn install -DskipTests); maven-reporting-api 4.0.0 and maven-archiver 4.0.0-beta-5 (releases). maven-reporting-exec 3.0.0-SNAPSHOT (worktree was installed only for the experiment below; the plugin does not depend on it.

    Per-goal status

    Goal Status Evidence
    site:effective-site ported ITs effective-site, inheritance-interpolation
    site:attach-descriptor ported ITs MSITE-566, site-attach-descriptor
    site:stage ported ITs site-sd*, site-skip (goal ran in site-inheritance, site-sd-lang, whose other assertions need reports)
    site:stage-deploy ported same ITs
    site:deploy ported ITs site-deploy, MSITE-548, MSITE-604, MSITE-705-*; unit tests over a DAV wagon, with and without proxy
    site:site partial: handwritten content only ITs MSITE-159, MSITE-354, doxia-formats, template-skin, resources, gh-1286-missing-skin, default-reports-excluded and others pass; no report, no project-info.html/project-reports.html
    site:jar partial: same as site IT site-jar
    site:auto-refresh partial: same as site IT auto-refresh
    site:run partial: same as site manual smoke test only
    site:help generated n/a

    Public API changes

    • Every mojo implements org.apache.maven.api.plugin.Mojo with org.apache.maven.api.plugin.annotations; Session, Project, Log and MojoExecution are injected into fields. AbstractSiteMojo.execute() is final and calls doExecute(); subclasses in other plugins must follow.
    • Removed protected members: mavenSession, repoSession, reactorProjects, remoteProjectRepositories, project as MavenProject, siteTool, i18n, siteRenderer, mavenReportExecutor (now getSiteTool(), getI18n(), getSiteRenderer()); constructors with injected components.
    • Removed classes: ReportDocumentRenderer, CategorySummaryDocumentRenderer (nothing can produce a MavenReportExecution), SiteDescriptorArtifactMetadata (unused Maven 3 artifact metadata). SitemapDocumentRenderer takes a String instead of a MojoExecution; DoxiaHandler loses the external-report branch.
    • New: SisuContainer, ParentAwareProject (package-private).

    User-visible changes

    • Needs Maven 4; <prerequisites> follows mavenVersion. The plugin.xml is only written in the v4 format when that prerequisite starts with 4., otherwise Maven 4 rejects the mojos with cannot be cast to org.apache.maven.plugin.Mojo.
    • No reports. Configured <reporting> plugins and the default maven-project-info-reports-plugin are skipped with WARNING Reports are not generated: ... Skipping N configured report plugin(s) and the default maven-project-info-reports-plugin. generateReports and generateProjectInfo are accepted and inert; no project-info.html, project-reports.html or report pages; <menu ref="reports"/> is dropped; <item ref="..."> to a report is removed with a warning.
    • @Mojo has no requiresReports or threadSafe, and requiresDependencyResolution = TEST is dropped (the v4 attribute is dependencyResolutionPathScopes, not used): the site goals no longer resolve test dependencies and are not declared thread-safe.
    • Velocity $project is the immutable org.apache.maven.api.model.Model, not MavenProject: $project.name, .url, .organization, .properties.get(...) still work; $project.parent is the <parent> element (no url, no further parent), and basedir, artifacts, compileSourceRoots are gone. $plexus is the plugin's private Sisu container, so $plexus.lookup("org.apache.maven.Maven") no longer works (IT doxia-formats now looks up SiteTool). Diff of the rendered velocity-context.html before/after shows only this and the version numbers.
    • siteOutputDirectory/outputDirectory no longer default to ${project.reporting.outputDirectory} (empty in Maven 4); unset means ${project.build.directory}/site, or <reporting><outputDirectory> if the POM sets one.
    • encoding, outputEncoding, outputTimestamp default from the POM properties project.build.sourceEncoding, project.reporting.outputEncoding, project.build.outputTimestamp read in code; ${basedir} defaults became ${project.basedir}; jarOutputDirectory and finalName use defaultValue expressions instead of property = "project.build.*".
    • site:jar/site:attach-descriptor attach through ProjectManager with createProducedArtifact; site:jar builds with new JarArchiver() and maven-archiver 4.0.0-beta-5.
    • site:stage takes the execution root from Project.isTopProject(). site:auto-refresh prompts through org.apache.maven.api.services.Prompter.
    • Deploy: wagons are looked up in the plugin's own class realm; wagon-file is added as a plugin dependency (a build without it was not tried), other providers must be plugin dependencies as before. Server and proxy passwords are decrypted with the Maven 3 SettingsDecrypter from maven-settings-builder 4.0.0-rc-7, because the Maven 4 API has no decryption service (known gap in Measure the impact of porting Maven components and plugins to the Maven 4 APIΒ #13302).
    • Test changes: SiteMavenProjectStub replaced by Mockito over the API interfaces (DeployTestSupport); the three deploy tests no longer use the harness. All 12 tests kept.
    • IT changes: doxia-formats looks up SiteTool instead of org.apache.maven.Maven; inheritance-interpolation walks only the child level in pom.apt.vm and drops the 6 assertions about the three ancestor rows (they need $project.parent to be a project, which the model is not). 22 report ITs are left failing, not edited.

    Gaps

    1. Reports: see the design note. The plugin realm of a v4 plugin only sees org.apache.maven.api.*; a probe mojo in the plugin realm failed to load MavenPluginManager, MavenSession, LifecycleExecutor, PluginVersionResolver, MavenProject, org.apache.maven.plugin.Mojo, org.apache.maven.artifact.Artifact, org.apache.maven.model.Model, org.apache.maven.di.Injector, DefaultSession, InternalSession (all ClassNotFoundException), and DefaultMavenReportExecutor (reporting-exec 3.0.0-SNAPSHOT) failed to initialise with NoClassDefFoundError; Sisu reports only NoSuchElementException: role MavenReportExecutor.
    2. Project.getParent() is empty for a parent that is not in the reactor. Maven 3 MavenProject.getParent() built it from the repository, and site descriptors (skin, banner, menus) and distributionManagement.site.url were inherited along that chain. Without a workaround, inheritance-interpolation stopped at the reactor parent and lost repo-parent's site descriptor (-X log: Reading parent level 2 site descriptor before, absent after); a project that takes its skin only from a repository parent would fail with "No skin is declared" (not run). Worked around in the plugin by ParentAwareProject, which builds the parent with ProjectBuilder.build(request.path(resolved pom)) and reports getBasedir() == null for it. The fix belongs in the API (Project.getParent()) or in doxia-sitetools.
    3. Model.getName() is null when the POM has no <name>; Maven 3 MavenProject.getName() fell back to the artifactId, and the ported DefaultSiteTool reads the model, so breadcrumbs lost the entries of nameless ancestors. ParentAwareProject.getModel() restores the fallback. The fix belongs in doxia-sitetools#701.
    4. Doxia, Doxia site tools, Wagon and the Maven 3 settings decrypter are Sisu components; v4 DI cannot inject them and Lookup does not see the plugin realm's Sisu index. SisuContainer starts a private DefaultPlexusContainer over the plugin class loader (SCANNING_INDEX). It works, but the plugin must declare org.eclipse.sisu.inject, guice 5.1.0 (the version in the Maven 4 distribution; Guice 6 not tried) and javax.inject, set version.plexus-xml to 4.2.0 (parent 50 manages 3.0.1, which fails with the class realm), and every Sisu failure surfaces as NoSuchElementException. SiteTool and SiteRenderer cannot be injected into a v4 mojo without this.
    5. No settings encryption or decryption API (already listed); maven-settings-builder and maven-settings 4.0.0-rc-7 are compile dependencies only for this. Only the proxy path is exercised (unit test with a proxy user and password); the server path is the same call and is not exercised with an encrypted password.
    6. Project has no public implementation, so the tests mock the interface with Mockito.

    What the Maven 4 API must add for reports

    What the Maven 3 site plugin does, by DefaultMavenReportExecutor (maven-reporting-exec), step by step, and what Maven 4.0.0-rc-7 offers:

    Step Maven 3 type used Maven 4 API
    Choose the version of a <reporting> plugin (missing version, RELEASE, pluginManagement) PluginVersionResolver none (Session.resolveVersion* resolves artifact versions, not plugin versions from metadata/prefixes)
    Load the plugin descriptor and create its class realm with the site plugin's reporting packages imported MavenPluginManagerHelper, MavenPluginManager.getPluginDescriptor/setupPluginRealm, PluginDescriptor, ClassRealm (with IMPORTS/EXCLUDES) api.Plugin (descriptor, class loader) exists but only for the plugin currently executing, reached through an injected MojoExecution; nothing returns a Plugin for another GAV; PluginXmlFactory parses a plugin.xml, nothing more
    Build a MojoExecution for goal with the merged configuration (pluginManagement + reporting + reportSet) new MojoExecution(plugin, goal, executionId) api.MojoExecution is an interface with no factory (XmlNode.merge exists for the configuration)
    Get a configured mojo: instantiate, inject Session/Project/Log, bind parameters with expressions, without executing it MavenPluginManager.getConfiguredMojo(Mojo.class, session, execution) none: the mojo instantiation, the v4 DI injector and PluginParameterExpressionEvaluatorV4 are in maven-core/maven-impl, not exported
    Run forked executions (@Execute) the report needs first LifecycleExecutor.calculateForkedExecutions/executeForkedExecutions none
    Decide whether an aggregator report may run MavenProject.isExecutionRoot() Project.isTopProject() covers it (reporting-exec's note that only isRootProject() exists is out of date)
    Get the MavenReport and call it cast of the mojo to MavenReport works for a v4 mojo that also implements MavenReport (reporting-impl 5.0.0-SNAPSHOT), once the mojo can be obtained

    Confirmed against rc-7 and against maven-api-core 4.1.0-SNAPSHOT (20260928): Session has no plugin-related method beyond getPluginContext(Project); Plugin/MojoExecution are only reachable from Event.getMojoExecution() and injection; Lookup.lookup does not see other plugin realms; LifecycleRegistry and ProjectBuilder do not help. A plugin cannot work around it: it can resolve the report plugin's artifacts and parse its plugin.xml, but would have to re-implement realm imports, DI, parameter expressions and forked executions (all inside maven-core/maven-impl), and bundling maven-core fails on class identity.

    Smallest addition that unblocks reports (sketch, in org.apache.maven.api.services):

    interface PluginManager extends Service {
        /** Resolves version (metadata, pluginManagement), descriptor and class realm of another plugin. */
        Plugin resolvePlugin(Session session, Project project, org.apache.maven.api.model.Plugin plugin, PluginRealmOptions options);
        /** New MojoExecution with the goal's descriptor and the given merged configuration. */
        MojoExecution createExecution(Plugin plugin, String goal, String executionId, XmlNode configuration);
        /** Instantiates and configures the mojo, like a normal execution but without calling execute(). */
        <T> T newMojo(Session session, Project project, MojoExecution execution, Class<T> type);
        /** Forked executions declared with @Execute. */
        void executeForked(Session session, Project project, MojoExecution execution);
    }

    PluginRealmOptions has to carry the packages the caller shares with the plugin's realm (here org.apache.maven.reporting, org.apache.maven.doxia.sink), which Maven 3 passed as IMPORTS/EXCLUDES. Project also needs getParent() to return repository parents (Gap 2) and the site tools need Sisu-free components (Gap 4).

    No-new-API alternative, not implemented: stop running reports in the site plugin's JVM-side lifecycle and let each report plugin run as an ordinary goal that writes Doxia source into ${project.build.directory}/generated-site (which site:site already renders); the menu and category summary would need a small per-report descriptor instead of MavenReport.getName/getCategoryName/getOutputName. That moves the contract from MavenReport to files, so every report plugin changes.

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-artifact, maven-resolver-provider, maven-reporting-exec, maven-plugin-annotations, the maven-archiver 3.x line and the Maven 3 resolver pins. Adds maven-api-* (provided), the Sisu/Guice/javax.inject runtime, maven-settings and maven-settings-builder (decryption) and wagon-file, so the dependency count does not go down.

    Recommendation: do not merge. Keep a 3.x line for reports. The site:site without reports, stage, stage-deploy, deploy, attach-descriptor, effective-site, jar, run and auto-refresh work on the Maven 4 API today and are a starting point for a v4 site plugin; it needs (1) a plugin-manager service like the sketch above, (2) Project.getParent() returning repository parents, (3) Sisu-free doxia-sitetools, (4) a settings decryption service, before reports and real-world site descriptors behave as on Maven 3. Until then a Maven 4 build that calls mvn site with this plugin silently produces a site without reports.

  19. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Wave 4 findings, part 3 of 4: maven-javadoc-plugin to maven-rar-plugin

    Each plugin is a local branch agent/mvn4-api with a "Build with Maven 4 only" commit and a "Port to the Maven 4 API" commit; the PRs are not opened yet.

    maven-javadoc-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17. Every goal is ported and runs as a direct goal on Maven 4.0.0-rc-7; nothing runs as a site report (blocked).

    Rebased 2026-10-06 onto master with apache/maven-javadoc-plugin#1390, so sibling modules are now invoked through maven-executor. Unit tests: 75 run, 0 failed, 8 skipped; ITs not rerun.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn clean verify β†’ 72 tests before (8 skipped, 0 failures), 75 after (8 skipped, 0 failures; 3 added); spotless, RAT and checkstyle pass. -Prun-its (93 ITs, run as two -Dinvoker.test= halves because the suite exceeds the 30 min time-box) β†’ before 79 passed, 3 failed, 11 skipped; after 75 passed, 7 failed, 11 skipped. Pre-existing failures, before and after: MJAVADOC-181, MJAVADOC-444 (both site), MJAVADOC-568_jar-mixed. The 4 new failures are all site ITs (MJAVADOC-134_multiaggregate, -259, -369, site-failOnError), see Gaps. The other 89 outcomes are identical. Skipped: JRE-version (doclava, JDK 23 fonts) and toolchain-version ITs. No test deleted; 13 MavenProjectStub classes removed because the v4 harness reads the POM (see tests below). testJavadocResourcesWithExcludes fails on a second run without clean, before and after.

    Per-goal status

    goal status evidence
    jar ported ITs MJAVADOC-137_jar, -812, -568_export-to-testcase, -599, -639_requires_ignored, reproducible, -610_mrjar, toolchain probe below; package build with attach and install
    test-jar ported no IT in the repo; probe project package+install attached and installed -test-javadoc.jar
    aggregate-jar, test-aggregate-jar ported ITs MJAVADOC-599, -618_modular-war, -639_requires_ignored; probe for test-aggregate-jar (jar contains the module's test class page)
    resource-bundle, test-resource-bundle ported probe: both bundles built, attached, installed; bundles consumed by dependencySource-1..4 ITs
    javadoc, test-javadoc, aggregate, test-aggregate, *-no-fork ported as direct goals (mvn javadoc:javadoc) about 50 ITs use them; partial as reports: mvn site has no v4 route
    fix, test-fix not in this source version removed before this branch (plugin.xml lists 15 goals, help included)
    toolchains ported jdkToolchain with JDK 21 running Maven and a JDK 8 toolchain: log Toolchain in maven-javadoc-plugin: JDK[...zulu-8...], JDK 8 output (allclasses-frame.html); build-context path via maven-toolchains-plugin 3.2.0 + jar in one package build also selects JDK 8
    module path ported, plexus-java kept ITs MJAVADOC-498_modulepath, -498_mm_modulepath, -449_aggr_modulepath, -639_aggr_static_modulepath, -555_link-automatic-modules, -575, -556, -568_manifest-splitpackage pass; see Gaps for why JavaPathType is not used
    detectLinks, detectOfflineLinks, detectJavaApiLink ported ITs MJAVADOC-580_detectLinks, detectLinks, -592, -495, -642_cmdline, -320, -275; probe: detectLinks resolved the dependency POM through ArtifactResolver + ProjectBuilder and validated the URL online β†’ -link https://commons.apache.org/proper/commons-lang/apidocs
    additionalDependencies, docletArtifact(s), tagletArtifact(s), resourcesArtifacts ported doclet/taglet ITs need JDK ≀13, so probes: -docletpath and -tagletpath held the artifact plus its compile-scope transitive dependencies, -classpath held the additional dependency; unit tests cover taglet/stylesheet/helpfile artifacts
    dependency sources (includeDependencySources) ported ITs dependencySource-1..4, MJAVADOC-338, -494_aggregate-repositories, -526

    Differential check of the report goals: the released 3.11.2 and this port run on the same probe projects under Maven 4.0.0-rc-7. The -X parameter dump of all 7 non-site goals is identical except detectOfflineLinks (3.11.2 had an older default) and the injected objects. For aggregate on a two-module reactor with provided and runtime scopes the javadoc options file is byte identical after path normalisation; javadoc and test-javadoc differ only in class path order. This found three defects that the ITs had not (fixed): ${project.name} left unevaluated, system scope dependencies dropped, runtime dependencies missing from the test class path.

    Concrete build error (reporting chain): as in the changelog finding. Real build, maven-site-plugin 3.22.0 on rc-7, MJAVADOC-134_multiaggregate: Failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Unable to lookup Mojo: Cannot cast org.apache.maven.plugins.javadoc.AggregatorJavadocReportFactory to org.apache.maven.plugin.Mojo. reporting-api 4.0.0 has no Maven 3 dependency, so MavenMultiPageReport is still implemented and compiles; only the site plugin is missing.

    User-visible changes

    • Needs Maven 4.0.0-rc-7 and Java 17 (was 3.6.3 / 8); version 3.12.1-SNAPSHOT β†’ 4.0.0-beta-1-SNAPSHOT.
    • Goals, parameter names, properties and defaults are unchanged (defaults compared by the differential run above). Exceptions: jarOutputDirectory and finalName no longer take -Dproject.build.directory / -Dproject.build.finalName (a v4 property is a user property, not an expression; now defaultValue); ${basedir} defaults are ${project.basedir}.
    • additionalDependencies element type AdditionalDependency is now a plain bean (groupId, artifactId, version, type, classifier, scope) instead of a subclass of the model Dependency; <exclusions>, <optional>, <systemPath> inside it are no longer accepted.
    • Class hierarchy: the *NoFork* mojos are now the base classes and the forking ones subclass them (an inherited @Execute cannot be cancelled). TestJavadocReport no longer extends JavadocReport. The plugin descriptor shows the same goals and executePhase values.
    • No requiresDependencyResolution: the mojos resolve in execute() (javadoc/jar: compile + provided + direct system; test goals: + test + runtime), so a goal no longer fails before the mojo for an unresolvable dependency but inside it.
    • locale is validated against the JVM locales only; the Doxia site tool also required a Maven Site translation.
    • Nested Maven runs for detectOfflineLinks use the default settings and toolchains files; -s, -gs, -t, -gt are not passed on (no v4 API).
    • Class path order of the dependencies differs from 3.x (same set).
    • mvn site with the plugin under <reporting> fails until maven-site-plugin has a v4 release.
    • Public/protected Java API: AbstractJavadocMojo implements org.apache.maven.api.plugin.Mojo; constructors with injected components are gone (field @Inject of Session, Project, MojoExecution, Log); MavenProject/MavenSession/Toolchain signatures become Project/Session/org.apache.maven.api.Toolchain; ResourceResolver is a plain class (was a Sisu component) and SourceResolverConfig takes a Session; resolveDependency takes AdditionalDependency and returns a Path.

    Gaps

    • Site reports: no v4 report contract accepted by maven-site-plugin 3.x (error above); needs the v4 site plugin and the Doxia site-tools port.
    • @Execute(phase = "none") fails plugin-tools 4.0.0-beta-3 (No enum constant LifecyclePhase.none) and @Execute is inherited, so no-fork mojos cannot opt out; worked around by reordering the classes.
    • No requiresDependencyResolution and no threadSafe attribute on @Mojo.
    • No PathScope includes system, and none combines compile, provided, runtime and test. The resolver therefore drops system dependencies (probe: -classpath empty where 3.11.2 had the jar) and the runtime scope for test goals. Workaround: direct system dependencies are read from the model's systemPath, test goals merge TEST_COMPILE and TEST_RUNTIME. Transitive system dependencies stay missing.
    • DependencyResolverResult.getDispatchedPaths() (what the jlink port uses) is not adopted for the module path: on a probe with requires org.objectweb.asm only, it still put the unrequired named module commons-lang3 on MODULES, and the result is the same before and after compile. The javadoc logic needs the main descriptor parsed from module-info.java sources (the javadoc goal forks only generate-sources), requires static, patch-module and Automatic-Module-Name cases, which plexus-java LocationManager provides; it depends on no Maven 3 type and stays. A switch would change which JARs go on the module path.
    • ${project.name} does not evaluate in parameter defaults and ${project.model.name} has no artifact id fallback and stays literal when the project has no name; the titles are resolved in code.
    • Project.getBuild().getSourceDirectory()/getResources() are not reliable in v4; ProjectManager.getEnabledSourceRoots is used. Project instances are not identity stable, so projects are compared by GAV.
    • Session exposes no settings or toolchains file location from -s/-gs/-t/-gt, only the configured defaults (Constants.MAVEN_USER_SETTINGS etc.).
    • Doxia SiteTool (doxia-integration-tools) is bound to Maven 3 types and Sisu: dropped, locale parsing reimplemented. Plexus ArchiverManager cannot be injected: new JarArchiver() / ZipUnArchiver are used directly.
    • Test harness (maven-testing rc-7): object-array parameters that declare a property make MojoExtension throw an NPE unless the test POM lists the element; an exact ${project.basedir} evaluates to a Path, so a String parameter stays null; ProjectStub.getLanguage() is null (the mojo treats a null language as Java); a test @Provides needs @Singleton.

    Tests: the 13 stubs under src/test/java/.../stubs are replaced by TestSessions (mock session with source roots, dependencies, artifact resolution from a local repo directory) and POM-based reactor projects; 37 test POMs list empty object arrays, use ${project.basedir}, and three aggregate configs declare <modules>; stale-test declares jar packaging (it said pom, which the old harness ignored). Added: default titles fall back to the artifact id, system scope class path, test goal runtime class path, locale parsing.

    Shared snapshots consumed: maven-common-artifact-filters 4.0.0-SNAPSHOT (from maven-common-artifact-filters, branch agent/mvn4-api, already in the local repository). Released: maven-archiver 4.0.0-beta-5, maven-reporting-api 4.0.0.

    Improvements: drops maven-core, maven-model, maven-settings, maven-plugin-api, maven-artifact, maven-plugin-annotations, maven-resolver-api/impl/util, javax.inject, maven-reporting-impl (javadoc link only), doxia-integration-tools, the Sisu index plugin, and the test dependencies maven-plugin-testing-harness, resolver connector/transport, Sisu; Mockito 4.11 β†’ 5.24.

    Recommendation: port the non-report goals (jar, test-jar, aggregate-jar, test-aggregate-jar, resource-bundle, test-resource-bundle) and direct javadoc:* use; they are complete and verified. Do not merge as a replacement for 3.x: mvn site reporting breaks until maven-site-plugin, maven-reporting-impl and doxia-sitetools have v4 releases in that order, and common-artifact-filters 4.0.0 must be released first. Keep a 3.x line. Open question for plugin-tools: make @Execute cancellable (or accept none) so the no-fork mojos need not become base classes.

    maven-jdeprscan-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify and mvn verify -Prun-its with Maven 4.0.0-rc-7, JDK 21 β†’ unit tests 3 before, 6 after (new: ToolchainSelectionTest, 3 tests), 0 failures; ITs 6 passed, 1 skipped before and after (invoker), 0 failures; spotless clean; dependency:analyze-only runs and passes.

    User-visible changes

    • Plugin now requires Maven 4.0.0-rc-7 (<prerequisites> follows mavenVersion) and Java 17 (was Maven 3.6.3 / Java 8). It no longer runs under Maven 3.
    • Goals jdeprscan, test-jdeprscan, list and all parameters (failOnWarning, forRemoval, release, for-removal) keep their names, properties and defaults.
    • @Mojo(threadSafe = true) is gone: the v4 Mojo annotation and MojoDescriptor have no thread-safety flag.
    • list loses requiresDirectInvocation = true: the v4 annotation has no such attribute (the descriptor has directInvocationOnly, the annotation cannot set it), so plugin.xml now says directInvocationOnly=false. The goal has no default phase, so it is still not bound implicitly.
    • requiresDependencyResolution (COMPILE / TEST) is replaced by an explicit DependencyResolver.resolve(session, project, PathScope.MAIN_COMPILE | TEST_COMPILE) in the mojo. The --class-path order is kept: classes directory (plus main classes for test-jdeprscan), then dependencies.

    Gaps

    • None blocking. v4 ToolchainManager covers both lookups the old code needed: getToolchainFromBuildContext(session, "jdk") and getToolchains(session, "jdk", {version=[9,)}). The reflection fallback for Maven 3.3.0 is gone because the API has the method directly.
    • Toolchain.findTool("jdeprscan") exists on the v4 interface, so no toolchain internals are needed.

    Improvements: drops maven-core, maven-plugin-api, maven-model, javax.inject (constructor injection replaced by @Inject fields on Session, ToolchainManager, DependencyResolver, Log); adds only maven-api-core, maven-api-di, maven-api-model (provided). No new test dependency: the toolchain-selection test uses java.lang.reflect.Proxy stubs. commons-lang3 and plexus-utils (Commandline, CommandLineUtils) stay because forking the tool has no v4 API.

    Recommendation: port; it is small and needs no shared component. Ship as 4.0.0-beta-1 on master and keep a 3.x line for Maven 3 users.

    maven-jdeps-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 11 unit tests before and after, 0 failures; mvn verify -Prun-its β†’ 7 passed, 0 failed, 2 skipped before (5m13s) and after (5m44s), the two skipped are unsupported-api_main/unsupported-api_test ("SKIPPED due to JRE version", same before and after); spotless clean. Toolchain fallback checked by hand (see Gaps). Shared snapshots consumed: none.

    Public API changes (Mojo base class, for subclasses only)

    • AbstractJDepsMojo implements org.apache.maven.api.plugin.Mojo instead of extending AbstractMojo; @Inject fields for Log, Project, Session, ToolchainManager (org.apache.maven.api.services), DependencyResolver. The (ToolchainManager) constructor is gone.
    • getProject() returns org.apache.maven.api.Project; getClassesDirectory() returns Path; getClassPath() no longer throws DependencyResolutionRequiredException; new abstract getPathScope().
    • Mojos declare @Mojo(name, defaultPhase) with string phases; execute() throws the unchecked MojoException. dotOutput is a Path. Goal names, parameter names and -D properties are unchanged.

    Gaps

    • @Resolution field injection does not work with maven-plugin-tools 4.0.0-beta-3: the generated plugin.xml has no <resolutions>, the field stays null (NPE "this.resolution is null" in all 7 ITs). Maven core supports it (DefaultMavenPluginManager reads getResolutions()), the descriptor generator does not write it (PluginDescriptorFilesGenerator only writes dependencyResolution). Worked around with an injected DependencyResolver and resolve(session, project, PathScope) inside execute().
    • Constructor injection of a mojo fails: the generated JDKInternalsMojoFactory calls a no-arg constructor ("method 'void ()' not found"). Field injection only.
    • threadSafe = true has no v4 @Mojo attribute; the flag is dropped, nothing replaces it.
    • requiresDependencyResolution has no attribute either (only dependencyResolutionPathScopes, whose generation I did not test). Resolution therefore happens on first use inside the mojo, not before it.
    • v3 getCompileClasspathElements()/getTestClasspathElements() included the project's own output directories; v4 resolveDependencies returns dependencies only, so the mojos prepend getOutputDirectory(ProjectScope.MAIN/TEST) themselves. ResolutionScope.TEST maps to PathScope.TEST_RUNTIME, COMPILE to MAIN_COMPILE.
    • project.getArtifacts() (used to match dependenciesToAnalyzeIncludes) maps to DependencyResolverResult.getDependencies() keyed by groupId:artifactId; same filtering.
    • Toolchains: covered. org.apache.maven.api.services.ToolchainManager has getToolchainFromBuildContext(Session, "jdk") (Optional) and getToolchains(Session, "jdk", Map), which replaces the 3.2.6 reflection hack; Toolchain.findTool("jdeps") is unchanged. Checked by hand with the installed plugin and a toolchains.xml holding only zulu-8: jdeps ran from zulu-8.jdk/.../bin/jdeps with the file and from the zulu-21.jdk JAVA_HOME with an empty <toolchains/>. Not tested: a toolchain selected by maven-toolchains-plugin (the build-context branch). No IT exercises toolchains, before or after.

    User-visible changes

    • Runs on Maven 4 only (v4 mojo descriptor); the plugin needs Java 17 to run. No 3.x support, so a 3.x line must stay for Maven 3 users.
    • Readonly parameters project, session are removed from the descriptor.
    • src/site/markdown/index.md still describes Maven 3.2.6 toolchain behaviour and the workflow still lists JDK 8 in matrix-exclude; neither was touched.

    Improvements: drops javax.inject, maven-plugin-annotations, maven-plugin-api, maven-core, maven-model, maven-artifact; adds maven-api-core, maven-api-di, maven-api-annotations (provided). commons-lang3 and plexus-utils stay (MatchPatterns, Commandline). The reflection on ToolchainManager.getToolchains is gone.

    Recommendation: port for the Maven 4 line, keep 3.x for Maven 3. Nothing in the plugin is blocked; the two tooling gaps (@Resolution descriptor output, constructor injection) are worth a plugin-tools issue.

    maven-jlink-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify and mvn verify -Prun-its with Maven 4.0.0-rc-7, JDK 21 β†’ unit tests 14 before (1 skipped, the Windows-only one), 17 after (1 skipped); ITs 28 passed, 1 skipped before and after (invoker, 23 min before, 21 min after); 0 failures; spotless clean; dependency:analyze-only (failOnWarning) passes. One removed test: getCompileClasspathElementsShouldSkipPomTypeArtifacts, because the code it covered (project.getArtifacts(), skipping pom artifacts) is gone; the resolver returns paths only. Four new tests for module-path resolution (plain JAR, directory without descriptor, project module-info.class, project without it).

    Do the v4 APIs cover toolchains and module-path resolution? Yes for both, with two small workarounds.

    • Toolchains: ToolchainManager.getToolchains(session, "jdk", requirements), getToolchainFromBuildContext(session, "jdk"), Toolchain.findTool("jlink") and Toolchain.matchesRequirements(...) replace the reflection on getToolchains, the ToolchainPrivate cast and JavaToolchainImpl. No gap.
    • Module path: DependencyResolver.resolve(session, project, PathScope.MAIN_RUNTIME) replaces requiresDependencyResolution = RUNTIME, project.getArtifacts() and plexus-java LocationManager. On a probe project (asm 6.0 with module-info.class, commons-lang3, javax.inject:1 with no module name) getDispatchedPaths() gave JavaPathType.MODULES = asm, lang3 and CLASSES = javax.inject, i.e. the same split the old code made (module, module, skipped as automatic). The mojo uses getPaths() plus DependencyResolverResult.getModuleDescriptor(path) because it needs the module name and the automatic flag; the resulting --add-modules set was identical to the 3.x plugin's on the probe (asm, lang3, project).
    • Workaround 1: getModuleDescriptor returns empty for the project's own target/classes, so the project's module-info.class is read with java.lang.module.ModuleDescriptor.read.
    • Workaround 2: it also returns empty for a JAR with only a file-name-based automatic name (plexus-java returned an automatic descriptor). An empty result for a regular file is treated as automatic and skipped; for a directory it is still the "does not have a module-info.java file" error.
    • Not expressible: the toolchain's JDK home can no longer be passed to module resolution (ResolvePathsRequest.setJdkHome). No IT or probe output changed; effect on system-module resolution is unmeasured.

    User-visible changes

    • Requires Maven 4.0.0-rc-7 (<prerequisites> follows mavenVersion) and Java 17 (was Maven 3.6.3 / Java 11).
    • additionalResources element type is now org.apache.maven.shared.filtering.Resource (maven-filtering 4) instead of the model Resource; MJLINK-80_additionalResources passes with the same configuration.
    • All other parameters and the jlink goal keep names, properties and defaults. requiresDependencyResolution is now an explicit resolve in the mojo.
    • The jlink packaging (artifact handler and lifecycle mapping) is still declared in META-INF/plexus/components.xml. Maven 4.0.0-rc-7 still honours it: every IT with <packaging>jlink</packaging> and <extensions>true</extensions> passes. The native SPI (TypeProvider, LifecycleProvider, PackagingProvider) was not adopted.
    • The classified artifact is attached with Session.createProducedArtifact(..., classifier, "zip", "jlink") and ProjectManager.attachArtifact; the unclassified one replaces the project's main artifact as before. projectHasAlreadySetAnArtifact now asks ProjectManager.getPath.

    Gaps

    • ProjectManager is not bound for @Inject; a Providers class with @Provides (as in maven-jar-plugin) supplies it. Same for plexus-build-api's BuildContext, which maven-filtering 4 needs.
    • ThreadBuildContext needs org.codehaus.plexus.logging, which the plugin realm does not see for a plain jar project (MJLINK-52_classifiers_duplicate_classifier failed loading org.codehaus.plexus.logging.AbstractLogEnabled); org.eclipse.sisu.plexus is declared for it (as maven-resources-plugin does) and whitelisted for dependency:analyze. Packaging-jlink ITs passed without it, so this is a class-loading difference between the two realms.
    • maven-shared-utils 3.5.0 (Commandline) and plexus-archiver stay: forking jlink and zipping have no v4 API.

    Improvements: drops maven-core, maven-plugin-api, maven-model, maven-artifact, javax.inject, plexus-java, maven-plugin-annotations; the JavaVersion.isAtLeast("14") check for the no-toolchain case is dead on a Java 17 baseline and is reduced to Runtime.version().feature().

    Shared snapshots consumed: none. maven-archiver 4.0.0-beta-5, maven-filtering 4.0.0-beta-1 and plexus-build-api 0.0.7 are released versions.

    Recommendation: port; nothing blocks it. Keep a 3.x line for Maven 3 users. Open question for the list: whether to move the jlink packaging to the v4 SPI or keep components.xml while Maven 4 honours it.

    maven-jmod-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ the module has no unit tests, before or after; mvn verify -Prun-its β†’ 18 ITs passed, 0 failed before (12m27s) and after (9m16s); spotless clean, RAT and dependency:analyze-only pass. Toolchain selection checked by hand (see Gaps). A first full IT run was cut short at the last IT (base-it) by a hung Maven process; the counts above are from a clean rerun after the final edit. Shared snapshots consumed: none.

    User-visible changes

    • Runs on Maven 4 only; needs Java 17 (was 8). A 3.x line must stay for Maven 3 users.
    • Goals, parameter names and -D properties are unchanged. jmodFile, modulePath, config, libs, outputDirectory, targetClassesDirectory are Path instead of File. Readonly project and session leave the descriptor, and so does the unused readonly compilePath (${project.compileClasspathElements} does not exist in v4).
    • hash no longer declares requiresDependencyResolution = COMPILE; it never used the result (it builds a command line and does not run it, same as before).
    • create resolves dependencies for main-runtime (compile and runtime, the same scopes as v3 RUNTIME) inside execute() through DependencyResolver, not before the mojo.
    • MojoFailureException and MojoExecutionException both become MojoException, so failures like "JMODS folder does not exists" are no longer separated from execution errors in the exception type.
    • The jmod file is attached with ProjectManager.attachArtifact(project, project.getMainArtifact()); the "You have to use a classifier" check is kept, based on ProjectManager.getPath(project).
    • Subclass API: AbstractJModMojo implements org.apache.maven.api.plugin.Mojo; @Inject fields Project, Session, ToolchainManager (org.apache.maven.api.services), Log; the (ToolchainManager) constructor and JModCreateMojo(ToolchainManager, LocationManager) are gone; getToolchain() returns org.apache.maven.api.Toolchain, getProject() the v4 Project, executeCommand(Commandline, Path).

    Gaps

    • ToolchainManager: covered. getToolchains(Session, "jdk", Map) replaces the reflection on MavenSession, getToolchainFromBuildContext(Session, "jdk") (Optional) replaces the 3.x call, and Toolchain.findTool("jmod") is unchanged. Checked by hand with the installed plugin and a toolchains.xml holding a zulu-21 symlink marked vendor=tc-test: with <jdkToolchain><vendor>tc-test</vendor></jdkToolchain> the debug line shows jmod from the toolchain path; without it, from JAVA_HOME. Not tested: a toolchain selected by maven-toolchains-plugin (build-context branch); no IT touches toolchains. JavaToolchainImpl.getJavaHome() has no v4 accessor (Toolchain has findTool, getModel, matchesRequirements), so ResolvePathsRequest.setJdkHome now gets the JDK home derived from the jmod executable, which only differs from v3 if a toolchain exists but provides no jmod.
    • PathType/JavaPathType: do not cover the module-path logic. rc-7 DependencyResolverResult.getDispatchedPaths() classifies each dependency alone from Type.getPathTypes() and the dependency's own module info; addOutputDirectory, which would take the project's own module-info.class, is documented "currently not called" (DefaultDependencyResolverResult). create needs the opposite: only modules reachable from the main module's requires go on --module-path, the rest on --class-path, .jmod dependencies move to the module path, and filename-based automodules get a warning. That stays in plexus-java LocationManager.resolvePaths (a plain library, now constructed with new LocationManager()), fed with the files from the resolver. DependencyResolverResult.warningForFilenameBasedAutomodules() exists but I did not wire it, to keep the message and the boxed warning unchanged.
    • JavaPathType.option(paths) returns two arguments (["--class-path", "a:b"]); the plugin passes --class-path=a:b with backslashes doubled for jmod, so it does not use it.
    • Packaging registration has no v4 equivalent and is untouched: META-INF/plexus/components.xml (ArtifactHandler and LifecycleMapping for jmod) still works, the ITs with <packaging>jmod</packaging> and <type>jmod</type> dependencies pass. rc-7 DefaultPackagingRegistry.lookup only consults a legacy LifecycleMapping and never the PackagingProvider beans of a project extension (read in maven-4.0.x, tag rc-7 plus 11 commits).
    • @Inject ProjectManager fails in a real build ("No binding to construct an instance for key ProjectManager" seen in the sibling rar port); used session.getService(ProjectManager.class).
    • @Resolution is not written to plugin.xml by maven-plugin-plugin 4.0.0-beta-1, so the field stays null and dependencies would be silently dropped; I avoided it by injecting DependencyResolver. Nothing here would have caught it: no unit tests, and the ITs only fail if the jmod is wrong.
    • maven-api-annotations has to be declared (provided) or dependency:analyze fails with "used undeclared" after the port.
    • maven-shared-utils 3.5.0 (Commandline, CommandLineUtils, Os, StringUtils, FileUtils, MessageUtils) and plexus-java 1.6.0 stay; neither is Maven API.
    • Not covered: a toolchain that lacks jmod; JDK 24+ without a jmods folder (the existing JEP 493 message is unchanged, I ran JDK 21 only).

    Consumers that break: none in the Apache Maven plugin and shared-component repositories reference maven-jmod-plugin or its classes; the jmod packaging is consumed by user projects and, in the estate, only by this plugin's own ITs.

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-artifact, maven-plugin-annotations, javax.inject; adds maven-api-core, maven-api-di, maven-api-annotations (provided). The reflection on ToolchainManager.getToolchains and JavaToolchainImpl are gone.

    Recommendation: port for the Maven 4 line, keep 3.x for Maven 3. Not blocked. Two API requests for apache/maven: a main-module-aware dispatch in DependencyResolverResult (wire addOutputDirectory) so LocationManager is no longer needed, and a Toolchain accessor for the JDK home.

    maven-pmd-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally (Maven 4.0.0-rc-7, zulu-21, plugin-tools 4.0.0-beta-3, plugin-testing 4.0.0-beta-4):

    • before mvn -B -ntp verify: 65 tests run, 0 failures, 0 errors, 8 skipped (Windows-only tests on macOS); BUILD SUCCESS. -Prun-its -DskipTests: 46 ITs, Passed 41, Failed 0, Skipped 5, 14m25s.
    • after mvn -B -ntp verify -Prun-its: 20 tests run, 0 failures, 0 errors, 8 skipped (same 8 Windows tests); ITs Passed 5, Failed 0 (5 new ITs, see below); BUILD SUCCESS, 1m36s. spotless:check passes; RAT and dependency:analyze ran in the same build.
    • 45 tests and 46 pre-existing ITs no longer run, see Gaps. Negative control: changing one expected count in a new IT's verify.groovy makes the IT FAIL.
    • Real Maven 4 runs of the installed plugin against hand-made target/pmd.xml / cpd.xml (no PMD run): see "Key finding".

    What ported. Non-report goals check, cpd-check, aggregate-pmd-check, aggregate-cpd-check are v4 mojos (org.apache.maven.api.plugin.Mojo, @Inject Log/Project, MojoException). Report goals pmd, cpd, aggregate-pmd, aggregate-cpd, aggregate-pmd-no-fork are blocked: their sources stay in the tree but are excluded from compilation (pom <excludes>/<testExcludes> with a comment).

    Key finding: check does not need the report goal; the only coupling is a fork plus a file

    • check/cpd-check (and the aggregate variants) read exactly one file: ${targetDirectory}/pmd.xml (cpd.xml for CPD), default ${project.build.directory}. They never touch the report object, resolution, rulesets or PMD analysis. Only PMD library use: PMDVersion.VERSION in the message, the modello xpp3 readers, and RuleViolation in ExcludeViolationsFromFile.
    • The coupling is the annotation @Execute(goal = "pmd") / "cpd" / "aggregate-pmd" / "aggregate-cpd": before each check, Maven forks the report goal, which runs PmdExecutor/CpdExecutor and writes pmd.xml/cpd.xml (XML is always produced, canGenerateReportInternal returns true for xml even with no files, so check can run on an empty result). No other state is passed.
    • Measured in a real Maven 4 build (installed plugin, scratch projects, no report goal):
      • mvn pmd:check with a handwritten target/pmd.xml (1 priority-3 and 1 priority-4 violation): BUILD FAILURE PMD 7.28.0 has found 2 violations. For more details see: .../target/pmd.xml; -Dpmd.verbose=true -Dpmd.failOnViolation=false prints the two PMD Failure: lines and BUILD SUCCESS; -Dpmd.failurePriority=2 gives has issued 2 warnings, BUILD SUCCESS; -Dpmd.skip=true skips. cpd-check: fails on cpd.xml with 1 duplication, passes with -Dcpd.failOnViolation=false, -Dcpd.skip skips.
      • Missing file: Unable to perform check, unable to find .../target/pmd.xml; -e shows Caused by: org.apache.maven.api.plugin.MojoException. v4 has no failure/error split: output reads the same as the old MojoFailureException ("Failed to execute goal ... on project x: message", BUILD FAILURE), and the same type is used for unreadable XML.
      • Multi-module (root pom + a + b): pmd:check runs per module, pom-packaging root skipped; pmd:aggregate-pmd-check runs once on the root (module steps SKIPPED), reads root target/pmd.xml; deprecated -Daggregate=true with check checks only the top project (isExecutionRoot() became Project.isTopProject()).
      • E1, fork to a goal that does not exist (check still annotated @Execute(goal="pmd"), report sources excluded): Could not find goal 'pmd' in plugin ... among available goals aggregate-cpd-check, aggregate-pmd-check, check, cpd-check, help. Fails before any check logic. That is why @Execute was removed from the four check mojos in this port.
      • E3, scratch copy with a stub v4 goal pmd that only writes pmd.xml, check annotated @Execute(goal = "pmd") (v4 annotation): rc-7 forks the v4 goal (>>> pmd:...:check > :pmd @ exp >>>, then --- pmd:check), check reads its output and fails as expected. So v4 fork v4 works; a v4 non-report producer goal can restore the original check behaviour.
    • Why the whole plugin cannot hold the report goals (one concrete error, not re-proven at length): with report and check mojos together, plugin-tools 4.0.0-beta-3 writes a 2.0.0 plugin.xml whose report mojos carry <requirements> (role org.codehaus.plexus.PlexusContainer, org.apache.maven.doxia.siterenderer.Renderer, org.apache.maven.doxia.tools.SiteTool; they come from @Component fields of AbstractMavenReport in reporting-impl 4.0.0). Maven 4.0.0-rc-7 then fails on every goal of the plugin: Failed to parse plugin descriptor ... ParseError at [row,col]:[357,7] Message: Unrecognised tag: '{http://maven.apache.org/PLUGIN/2.0.0}requirements'. A v4 and a v3-report mojo cannot share one artifact today. The already-proven chain (site plugin cast error, reporting-impl needing maven-core) stays as the reason the report goals cannot simply be ported.

    Aux classpath and ruleset resolution without Sisu

    Ruleset resolution (PmdReport.resolveRulesets, plexus-resources ResourceManager):

    • DefaultResourceManager (1.4.0) has a public constructor taking Map<String, ResourceLoader>; the loaders have public no-arg constructors. No Sisu needed: new DefaultResourceManager(Map.of(FileResourceLoader.ID, new FileResourceLoader(), URLResourceLoader.ID, new URLResourceLoader(), ThreadContextClasspathResourceLoader.ID, new ThreadContextClasspathResourceLoader(), JarResourceLoader.ID, new JarResourceLoader())).
    • Verified with a standalone program (plexus-resources 1.4.0 + slf4j + plexus-utils only, no container): after addSearchPath(FileResourceLoader.ID, dir) and setOutputDirectory(out), getResourceAsFile("myrules.xml","001-myrules.xml") copies the file from the search path; a classpath resource (t/cp-rules.xml) is found through the thread-context classloader; a missing one throws ResourceNotFoundException. NOT exercised: http(s) rulesets (URLResourceLoader), and whether the TCCL is the plugin realm inside a v4 mojo (the ported plugin default rulesets live in plugin resources). The search paths the report adds map to project.getPomPath().getParent(), project.getBasedir(), and the session base directory (v4: session.getRootDirectory()/top directory, not compared against getRequest().getBaseDirectory()).
    • The copy-to-rulesetsTargetDirectory logic, determineRulesetFilename, getLocationTemp and the 001-name.xml naming are plain Java.

    Aux classpath (PmdReport.determineAuxClasspath + ConfigurationService):

    • v3 uses MavenProject.getCompileClasspathElements()/getTestClasspathElements() (needs requiresDependencyResolution=TEST) and, for aggregation, an aether CollectRequest through Provider<MavenSession> + RepositorySystem (both Sisu-injected), excluding reactor siblings and then adding each module's class dirs.
    • v4 equivalent, prototyped in a scratch mojo (aggregator=true, @Inject Session, session.getService(DependencyResolver.class), DependencyResolverRequest.builder().session(s).project(p).requestType(RESOLVE).pathScope(...), getPaths()), run on root + a (commons-io compile, javax.inject provided, junit test, slf4j-simple runtime) + b (depends on a):
      • PathScope.MAIN_COMPILE = {COMPILE, PROVIDED, COMPILE_ONLY}: the same set as getCompileClasspathElements (a gets commons-io + javax.inject). PathScope.TEST_COMPILE = {COMPILE, PROVIDED, TEST, TEST_ONLY} omits runtime deps; PathScope.TEST_RUNTIME = {PROVIDED, COMPILE, RUNTIME, TEST_RUNTIME, TEST} (adds slf4j-simple) is the match for getTestClasspathElements.
      • The project's own output directories are not in the result: prepend project.getOutputDirectory(ProjectScope.MAIN) and, for tests, ProjectScope.TEST, and keep the existing emptyOrNotExisting filter.
      • Reactor siblings ARE resolved by the v4 resolver: with mvn compile, b's resolved paths contain a/target/classes (a DIR) plus a's transitive commons-io. That replaces the v3 exclusion-list and per-module class-dir loop of ConfigurationService; aggregate-* only needs to loop session.getProjects() (filtering to the aggregated modules by base directory, as modulesForAggregatedProject does) and call the resolver per project. NOT verified: behaviour without compile in the same build (sibling would resolve to a jar/repo artifact), and system-scope deps.
      • Source roots: session.getService(ProjectManager.class).getEnabledSourceRoots(p, ProjectScope.MAIN|TEST, Language.JAVA_FAMILY) gives src/main/java and the generated-sources dir (prototype output). There is no getCompileSourceRoots in rc-7 ProjectManager; compileSourceRoots/testSourceRoots parameters (${project.compileSourceRoots}) need re-checking in a v4 build.
    • Toolchains: org.apache.maven.toolchain.Toolchain/ToolchainManager are no longer in maven-core 4.0.0-rc-7 (only in maven-compat). The v4 API is org.apache.maven.api.Toolchain and org.apache.maven.api.services.ToolchainManager (getToolchains(session,"jdk",map), getToolchainFromBuildContext(session,"jdk") returns Optional), obtained with session.getService(...). The report-side edits below use it; they compiled before the sources were excluded, but were never run.

    Public API changes

    • AbstractPmdViolationCheckMojo<D>: extends AbstractMojo becomes implements org.apache.maven.api.plugin.Mojo; field project is org.apache.maven.api.Project (@Inject, no longer a ${project} parameter); log via @Inject Log, getLog() kept; targetDirectory is Path with defaultValue=${project.build.directory} (property project.build.directory kept); execute() throws MojoException only.
    • Check mojos: @Mojo is org.apache.maven.api.plugin.annotations.Mojo (defaultPhase="verify"; threadSafe has no v4 attribute and is dropped); @Execute removed from all four.
    • ExcludeFromFile/ExcludeViolationsFromFile/ExcludeDuplicationsFromFile.loadExcludeFromFailuresData throw MojoException (was MojoExecutionException); AbstractPmdReport.getPmdVersion() no longer used by check (PMDVersion.VERSION).
    • Edited but excluded from the build (never run): ServiceExecutor, PmdServiceExecutor, CpdServiceExecutor, PmdReport, AggregatorPmdReport, AggregatorPmdNoForkReport lost the ToolchainManager constructor parameter and use the v4 toolchain API; CpdExecutor/PmdExecutor catch MojoException.
    • Version 3.29.0-SNAPSHOT to 4.0.0-beta-1-SNAPSHOT; javaVersion 17; mavenVersion 4.0.0-rc-7; <prerequisites><maven> is ${mavenVersion}; plugin-tools 4.0.0-beta-3; plugin-testing 4.0.0-beta-4.

    Gaps

    • Report goals (pmd, cpd, aggregate-pmd, aggregate-cpd, aggregate-pmd-no-fork) blocked: plugin.xml <requirements> parse error above, plus the proven reporting chain. Not ported, not running.
    • No non-report producer goal yet, so nothing in the Maven 4 plugin runs PMD/CPD; check needs a pmd.xml/cpd.xml from elsewhere (an older plugin's pmd:pmd, the PMD CLI, or a future v4 goal).
    • PMD/CPD execution engine (exec/*) is not ported. Its only hard ties to the report API are MavenReportException and the classloader fork path: Executor.buildClasspath() walks URLClassLoader.getURLs() of the plugin realm and of ConsoleLogger's classloader (plexus-container-default from core); not exercised on Maven 4.
    • No v4 isExecutionRoot: Project.isTopProject() is used; difference from MavenSession.isExecutionRoot() with -f/-pl not tested.
    • No v4 failure/error distinction (MojoFailureException vs MojoExecutionException): one MojoException.
    • Removed from the build, all exercising the excluded report code (with src/test left in the tree): CpdReportTest (13), PmdReportTest (26), PmdReportNumberOfThreadsTest (5), exec/ExecutorTest (1); helpers CapturingPrintStream (needs org.slf4j.impl.MavenSlf4jSimpleFriend, which no longer ships with Maven 4), DependencyArtifactStubFactory, stubs/** (v3 MavenProject stubs). Also the 46 pre-existing ITs are not selected (<pomIncludes> is check-*/pom.xml): they run clean site, pmd:pmd or a forked pmd:check. Test dependencies only those tests used were removed: wiremock, commons-io, commons-lang3, maven-embedder, maven-resolver-* (the Maven 3 resolver 1.9.27 provided jar also broke the v4 harness with NoClassDefFoundError: org/eclipse/aether/collection/VersionFilterBuilder).
    • PmdViolationCheckMojoOnWindowsTest ported identically (8 tests) but only skipped here (macOS).
    • Unverified at runtime: @Mojo(aggregator=true) under -T, Project injection on projects loaded from -f other poms.

    User-visible changes

    • Requires Maven 4.0.0-rc-7+ and Java 17 (was Maven 3.6.3 / Java 8); not usable on Maven 3.
    • Goals no longer in the artifact: pmd, cpd, aggregate-pmd, aggregate-cpd, aggregate-pmd-no-fork. <reporting> entries for this plugin and mvn site output (HTML report, xref links) are gone.
    • check, cpd-check, aggregate-pmd-check, aggregate-cpd-check no longer run PMD/CPD first. A build that bound check to verify and relied on the fork now fails with Unable to perform check, unable to find <dir>/pmd.xml unless an earlier step produced the file.
    • Parameters of the check goals are unchanged by name/property/default (failOnViolation, failurePriority, maxAllowedViolations, excludeFromFailureFile, verbose, printFailingErrors, skip, deprecated aggregate, targetDirectory). project is no longer a configurable parameter. ${basedir} in parameter values is not expanded by v4: use ${project.basedir} (two unit-test poms changed for that).
    • threadSafe flag not declared on the mojos.
    • Failure output: same BUILD FAILURE message; stack trace under -e names org.apache.maven.api.plugin.MojoException.

    Improvements

    • Runtime dependencies dropped from the plugin: maven-core/artifact/model/plugin-api (now maven-api-core/di/annotations/xml, provided), org.eclipse.sisu.plexus and javax.inject (DI index is generated: META-INF/maven/org.apache.maven.api.di.Inject, no hand upkeep needed here, <proc> is not none), plexus-utils, plexus-resources, plexus-i18n, doxia-core/sink-api, maven-reporting-api/impl, slf4j-api; sisu-maven-plugin and animal-sniffer-maven-plugin removed (its java18 signature would reject Java 17 APIs). Kept: pmd-core (needed), pmd-java/javascript/jsp runtime (only the excluded report goals need them), plexus-xml (xpp3 readers).
    • 5 new ITs (maven-invoker, through the existing run-its profile) that run the goals against precomputed results in results/ with <targetDirectory>${project.basedir}/results</targetDirectory>: fails on 2 violations; failurePriority=3 with verbose gives 1 violation and issued 1 warning; cpd-check with failOnViolation=false succeeds; missing results fail with the message; aggregate-pmd-check on a pom root checks only the root.

    Recommendation

    Land the check goals as a v4 plugin slice now and do not try to keep the reports in the same artifact until plugin-tools/Maven accept v3 report mojos in a 2.0.0 descriptor. Next step for a usable v4 plugin: a non-report producer goal (PmdExecutor/CpdExecutor with MojoException instead of MavenReportException, rulesets via the hand-built DefaultResourceManager, aux classpath via DependencyResolver with MAIN_COMPILE/TEST_RUNTIME plus own output dirs, toolchain via api.services.ToolchainManager), which the check goals can fork with the v4 @Execute(goal=...) (E3 shows that works). The HTML report then stays with the 3.x line or a separate artifact once the reporting chain moves.

    maven-rar-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported (packaging registration stays on the Maven 3 component model), 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 4 unit tests before, 5 after, 0 failures, 0 skipped; mvn verify -Prun-its β†’ 3 ITs passed, 0 failed before (3m08s), 4 passed, 0 failed after (2m42s), the fourth (dependencies) is new; spotless clean, RAT and dependency:analyze-only pass in the verify run. The unit tests were rewritten for the v4 harness (maven-testing), so the counts are not like-for-like: the three former tests are kept, plus one for optional and non-library dependencies. Shared snapshots consumed: none (maven-archiver 4.0.0-beta-5 and maven-filtering 4.0.0-beta-1 are released).

    User-visible changes

    • Runs on Maven 4 only; needs Java 17. A 3.x line must stay for Maven 3 users.
    • Goal, parameter names and -D properties are unchanged. Readonly session and project leave the descriptor; threadSafe = true has no v4 @Mojo attribute and is dropped.
    • RarResource (the <rarResources> element type) now extends org.apache.maven.shared.filtering.Resource instead of org.apache.maven.model.Resource; the XML elements are the same.
    • rarSourceDirectory, raXmlFile, manifestFile, outputDirectory are Path instead of File; getBuildDir() and getRarFile(...) (protected) change to Path.
    • Dependencies are resolved for main-runtime inside execute(); the v3 mojo declared requiresDependencyResolution = TEST, so test-scope dependencies are no longer resolved and an unresolvable test dependency no longer fails the goal.
    • A dependency is copied when it is not optional and its Type has path types (class path or module path); that replaces ArtifactHandler.isAddedToClasspath(). A pom or rar dependency is left out by construction (RarArtifactHandler sets addedToClasspath=false); only jar, optional and test scope are covered by a test.
    • A blank classifier is now treated as no classifier and sets the main artifact. I did not measure what the v3 mojo did with the empty default.
    • @Parameter defaults use ${project.basedir} (see Gaps).

    Gaps

    • Packaging registration has no v4 equivalent. RarLifecycleMappingProvider (Provider<LifecycleMapping>) and RarArtifactHandler still use javax.inject and maven-core classes (org.apache.maven.lifecycle.mapping.*, DefaultArtifactHandler), so maven-core and javax.inject stay as provided dependencies. maven-api-spi has PackagingProvider, TypeProvider and LifecycleProvider, but in rc-7 DefaultPackagingRegistry.lookup only looks up a legacy LifecycleMapping by id, and its provider list is injected at construction, so a provider shipped by a project extension is never consulted (read in maven-4.0.x, tag rc-7 plus 11 commits). The default-extension IT passes with the legacy classes.
    • @Inject ProjectManager fails in a real build: "No binding to construct an instance for key ProjectManager" (the maven-testing harness does bind it, so the unit tests were green). Workaround: session.getService(ProjectManager.class).
    • @Resolution field injection is not usable: maven-plugin-plugin 4.0.0-beta-1 writes no resolution into plugin.xml, the field stays null. My first port copied no dependencies and passed all unit tests and the 3 existing ITs, none of which has a dependency. Fixed with an injected DependencyResolver and resolve(session, project, PathScope.MAIN_RUNTIME); the new dependencies IT guards it. I did not run a negative control against the @Resolution version.
    • ${basedir} is not expanded in a v4 @Parameter(defaultValue) (the work directory ended up as <basedir>/${basedir}/src/main/rar); ${project.basedir} is. The harness does not expand ${basedir} in plugin configuration either, so the tests set path parameters in code.
    • maven-filtering 4.0.0-beta-1 needs a BuildContext binding, so the plugin adds Providers (@Provides BuildContext) and plexus-build-api 0.0.7; ThreadBuildContext extends Plexus AbstractLogEnabled, so org.eclipse.sisu.plexus 1.1.0 stays on the plugin class path (NoClassDefFoundError without it).
    • MavenArchiver.createArchive (maven-archiver 4.0.0-beta-5) takes the v4 Session and Project and throws unchecked MavenArchiverException; archive.setManifestFile takes a Path. JarArchiver is no longer injectable, so the mojo does new JarArchiver().
    • Not covered: a multi-module reactor build in which the RAR depends on a sibling module; filterRarSourceDirectory with delimiters (only the existing filtered IT).

    Consumers that break: none in the Apache Maven plugin and shared-component repositories use its classes. maven-ear-plugin only lists maven-rar-plugin:${mavenRarPluginVersion} as an IT extra artifact and stays on the 3.x version until bumped.

    Improvements: drops maven-plugin-api, maven-core (only for the packaging registration, see Gaps), maven-model, maven-artifact, maven-plugin-annotations, plexus-utils, junit 4, junit-vintage-engine, maven-plugin-testing-harness 3.x and the five Maven 3 project/artifact test stubs; adds maven-api-core, maven-api-di (provided), maven-testing, mockito-core (test) and the two runtime dependencies named under Gaps.

    Recommendation: port for the Maven 4 line, keep 3.x for Maven 3. Not blocked; the packaging registration should move to the SPI once DefaultPackagingRegistry consults PackagingProvider for project extensions, which is an API request for apache/maven. Worth a plugin-tools issue: @Resolution is not written to plugin.xml.

  20. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Wave 4 findings, part 4 of 4: maven-scm-publish-plugin to maven-toolchains-plugin, then maven-changes-plugin and maven-project-info-reports-plugin

    Each plugin is a local branch agent/mvn4-api with a "Build with Maven 4 only" commit and a "Port to the Maven 4 API" commit; the PRs are not opened yet.

    maven-remote-resources-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported (reduced supplemental-model merging, see Gaps), 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify -Prun-its with Maven 4.0.0-rc-7, JDK 21 β†’ 11 unit tests, 9 failsafe ITs and 7 invoker ITs before (8:39 min), 11, 9 and 7 after (4:10 min), 0 failures; spotless clean. The unit test class is rewritten (see Gaps), the ITs are untouched.
    Snapshots consumed from the local repository (not rebuilt here): maven-filtering 4.0.0-beta-2-SNAPSHOT, maven-archiver 4.0.0-beta-6-SNAPSHOT (org.apache.maven.shared), maven-common-artifact-filters 4.0.0-SNAPSHOT (the agent/mvn4-api port).

    v4 equivalents

    Was Is
    ProjectBuilder.build(Artifact, request) β†’ MavenProject Session.resolveArtifact of the pom artifact, then ModelBuilder.newSession().build(ModelBuilderRequest…requestType(CONSUMER_DEPENDENCY).source(Sources.resolvedSource(pom, key))) β†’ getEffectiveModel(). api.ProjectBuilder is unusable here: ProjectBuilderResult.getProject() is empty for a repository POM because DefaultSession.getProject returns null when the project has no base directory. BUILD_EFFECTIVE fails on invalid dependency POMs ('distributionManagement.status' must not be specified for maven-plugin-api:2.0); CONSUMER_DEPENDENCY tolerates them like VALIDATION_LEVEL_MINIMAL did (MRRESOURCES-121 IT).
    MavenProject.getArtifacts() / getDependencyArtifacts() Session.collectDependencies(project, TEST_RUNTIME) flattened / root.getChildren(), as Dependency sets fed to the v4 common-artifact-filters
    RepositorySystem.resolveArtifact + ArtifactHandlerManager Session.requireType(type) (extension, classifier) + Session.resolveArtifact(artifact, ProjectManager.getRemoteProjectRepositories(project))
    MavenSession.getProjects() output dirs Project.getOutputDirectory(ProjectScope.MAIN / TEST)
    project.getResources().add(Resource) ProjectManager.addSourceRoot(project, scope, Language.RESOURCES, path)
    project.getResources() iteration ProjectManager.getEnabledSourceRoots(project, MAIN, Language.RESOURCES), SourceRoot.stringFiltering()
    MavenXpp3Reader for supplements ModelXmlFactory.read(XmlReaderRequest)
    plexus ResourceManager injection new DefaultResourceManager(Map<id, loader>) built by hand; still exposed as $locator

    Velocity context objects

    • project and each element of projects: MavenProject β†’ RemoteResourcesProject (new, public), a wrapper over the immutable org.apache.maven.api.model.Model with the descriptive getters (groupId, artifactId, version, packaging, name, description, url, inceptionYear, organization, licenses, developers, contributors, mailingLists, scm, issueManagement, ciManagement, distributionManagement, build, dependencies, properties, id, basedir, model). Returned values are v4 model classes (same getter names); properties is a Map<String,String>.
    • $project.artifact keeps the textual form groupId:artifactId:type:version (type = the model packaging), so the bundled DEPENDENCIES template output is unchanged (MRRESOURCES-121 asserts …maven-plugin-api:jar:2.0). The object is no longer an Artifact (no getFile()).
    • projectsSortedByOrganization keys are org.apache.maven.api.model.Organization; projects sort by groupId, artifactId, version.
    • Unchanged: presentYear, projectTimespan, locator, user properties.
    • Gone: every MavenProject-only method (getFile, getParent, getArtifacts, getBuild().getResources() as mutable, …); templates using them need $project.model.

    Public API changes

    • Mojos implement org.apache.maven.api.plugin.Mojo; @Inject fields (Session, Project, Log, MavenFileFilter); constructors are no-arg (a constructor with parameters fails at lookup: the generated …MojoFactory calls <init>()). Protected mavenSession β†’ session (api.Session), project is api.Project; abstract getAllDependencies() / getDirectDependencies() return Set<org.apache.maven.api.Dependency>; getProjects() returns List<RemoteResourcesProject>; getSupplement, mergeModels use api.model.Model.
    • ModelInheritanceAssembler.assembleModelInheritance returns the merged Model instead of mutating; ModelUtils is removed.
    • Defaults ${basedir}/src/main/resources and ${basedir}/src/main/appended-resources became ${project.basedir}/…: Maven 4 does not evaluate ${basedir} in @Parameter defaults (the bundle goal silently skipped with "skip non existing resourceDirectory ${basedir}/src/main/resources").

    Gaps

    • SourceRoot is immutable, so a project resource that overrides a bundle resource is no longer excluded from the project's resources (resource.addExclude); both copies reach the resources plugin. ITFilterLocalOverride and ITGenerateFromOverride pass.
    • Supplemental-model assembly is reduced: descriptive metadata, properties, dependencies, dependencyManagement, repositories and the build directories/filters/resources are merged; plugins, pluginManagement, extensions and reporting are not (no v4 API to merge models, maven-impl's assembler is internal). They only matter if a template reads them. ITSupplementalArtifact passes.
    • requiresDependencyResolution = TEST has no attribute in use; dependencies are collected on demand. resolveScopes was already unused.
    • The filtering component needs a BuildContext: Providers (@Named, @Provides ThreadBuildContext) plus plexus-build-api and org.eclipse.sisu.plexus at runtime (for AbstractLogEnabled), as in maven-resources-plugin.
    • Tests: RemoteResourcesMojoTest no longer uses AbstractMojoTestCase and is rebuilt on Mockito mocks of Session/Project/ProjectManager (same 11 scenarios, renamed to camelCase). Removed, with reason: stub/ArtifactStub, MavenProjectBasicStub, MavenProjectBuildStub, MavenProjectResourcesStub, ModelStub (v3 MavenProject stubs with no v4 counterpart), src/test/resources/unit/rrmojotest/*.xml (mojo configs for the old lookup harness). The unit tests therefore do not exercise real dependency resolution; the ITs do.

    User-visible changes: requires Maven 4; Velocity templates that call MavenProject methods beyond the list above break; the ${basedir} defaults are now ${project.basedir}; local resources overriding a bundle are copied twice (same content). ASF parent POMs bind this plugin, so they need the 4.x plugin on Maven 4 only. No Java code under the Apache Maven repositories imports org.apache.maven.plugin.resources.remote.

    Improvements: drops maven-core, maven-model, maven-model-builder, maven-plugin-api, maven-artifact, maven-resolver-api/provider/util, maven-plugin-annotations, javax.inject, and from tests junit4, the vintage engine, maven-plugin-testing-harness and maven-resolver-impl; adds maven-api-core/annotations/model/di (provided), plexus-build-api, mockito-core 5.24.0 (tests, replaces the harness stubs).

    Recommendation: port for Maven 4; keep the 3.x line for Maven 3. Ask core for a ProjectBuilder result that works for repository POMs (or document ModelBuilder + CONSUMER_DEPENDENCY), and for a documented ${basedir} alias in parameter defaults.

    maven-scm-publish-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ no unit tests exist, before or after; mvn verify -Prun-its β†’ 5 passed, 0 failed before (5m09s) and after (4m57s); spotless clean. Also run by hand with the installed plugin: credentials from a settings <server> (see Gaps) and a no-project publish to a local bare git repo (BUILD SUCCESS, commit and index.html present, seed file deleted as expected). Shared snapshots consumed: none (maven-scm 2.2.1 release; the maven-scm library modules use no Maven API and are used unchanged; maven-release-manager is dropped, not ported).

    Public API changes (Mojo base classes, for subclasses only)

    • AbstractScmPublishMojo implements org.apache.maven.api.plugin.Mojo; constructor (ScmManager, ScmRepositoryConfigurator) is gone; @Inject fields Log, Session, Prompter; ScmPublishPublishScmMojo.project is now org.apache.maven.api.Project; the settings field is gone; execute()/scmPublishExecute() throw the unchecked MojoException.
    • @Mojo(projectRequired = false, aggregator = true) replaces requiresProject = false.
    • New package-private ScmManagerFactory (builds the ScmManager).

    Gaps

    • ScmManager and ScmRepositoryConfigurator cannot be injected. Both are Sisu JSR 330 components (META-INF/sisu/javax.inject.Named), which the v4 plugin container does not read, and ScmRepositoryConfigurator.getConfiguredRepository(ReleaseDescriptor, org.apache.maven.settings.Settings) takes the v3 Settings type, which Session.getSettings() (org.apache.maven.api.settings.Settings) does not provide. I did not try to keep maven-release-manager. Replacement: ScmManagerFactory reads the Sisu index from the plugin class loader, instantiates each @Named ScmProvider (first hint wins, as in DefaultScmManager) into a BasicScmManager; debug log shows git, jgit, hg, svn registered. A provider needs a no-arg constructor or the Plexus Prompter constructor (jgit, served by an adapter over the v4 org.apache.maven.api.services.Prompter); any other is skipped with a warning. This is the piece maven-scm would have to fix properly (a non-Sisu way to obtain a ScmManager, such as a ServiceLoader registry).
    • Settings/servers: Session.getSettings().getServers() is a plain list, so the getServer(id) lookup and the host fallback (host[:port]) are reimplemented in the mojo, along with the username/password/privateKey/passphrase precedence of DefaultScmRepositoryConfigurator. The v4 API has no decrypt service; Maven 4's DefaultSettingsBuilder decrypts settings itself (read in the maven-4.0.x checkout at e8fd05a), so the mojo uses the values as given. Not run against an encrypted password. Observed: svn --username alice --password ... taken from <server id="myserver"> via ${project.model.distributionManagement.site.id}.
    • Plugin expressions: ${project.distributionManagement.site.url} and ${project.name} do not evaluate in v4 (the evaluator reflects on api.Project, which has no such getters). The first ITs failed with "The scm url cannot be null". Defaults are now ${project.model.distributionManagement.site.url|id} and ${project.model.name}; ${project.reporting.outputEncoding} still resolves as a property.
    • ${settings} and ${project} parameters have no v4 form; replaced by Session.getSettings() and an injected Project. With projectRequired = false and no pom, the injected Project is null and the mojo handles it (publish without a project verified).
    • Left as is, warnings only: maven-shared-utils MessageUtils (deprecated; the v4 MessageBuilderFactory exists), Model.getModules() and ScmProviderRepository.setPersistCheckout (deprecated).

    User-visible changes

    • Maven 4 only; Java 17 to run.
    • Parameters settings and project removed; all other parameter names, properties and the maven.site.deploy.skip alias are unchanged (alias present in the generated plugin.xml).
    • Default expressions changed as above; users overriding pubScmUrl, serverId or checkinComment are unaffected. Without a project the default checkin comment still contains the literal ${project.model.name} (Maven 3 behaviour not compared).
    • Third-party SCM providers added as plugin dependencies are found only if they publish the Sisu index and have a supported constructor.

    Improvements: drops maven-release-api, maven-release-manager, maven-core, maven-model, maven-settings, maven-plugin-api, maven-plugin-annotations; adds the maven-api-* jars (provided). javax.inject moves from provided to runtime (needed to read @Named hints; providers already depend on it) and plexus-interactivity-api 1.4 becomes explicit (already transitive via the jgit provider; the adapter implements its interface).

    Recommendation: port for the Maven 4 line, keep 3.x for Maven 3. The port works, but the in-plugin provider bootstrap is a workaround; ask maven-scm for a non-Sisu ScmManager factory before releasing.

    maven-scripting-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn verify with Maven 4.0.0-rc-7, JDK 21 β†’ 1 test before and after, 0 failures; -Prun-its 5/5 ITs pass before and after (whole suite, no time-box hit); spotless clean. Not measured: running the ported plugin under Maven 3.

    Uses maven-api-core/maven-api-di/maven-api-annotations 4.0.0-rc-7 (provided) and plugin-tools 4.0.0-beta-1. No shared component needed.

    User-visible changes

    • Goal scripting:eval and its parameters (engineName, script, scriptFile, scriptResource) are unchanged.
    • The plugin no longer runs on Maven 3 (v4 Mojo, @Inject).
    • Script-visible bindings (the GLOBAL_SCOPE Bindings passed to every engine): the names stay project and log, the types change.
      • project: org.apache.maven.project.MavenProject β†’ org.apache.maven.api.Project. Still there: groupId, artifactId, version, basedir (now java.nio.file.Path, was File), model, build (now org.apache.maven.api.model.Build), parent (now Optional<Project>), artifacts (now List<ProducedArtifact>). Gone: getFile() (use pomPath), getProperties() (use model.properties), getName()/getDescription() (use model.name/model.description), getCollectedProjects(), getArtifact(), getRemote*Repositories(), getPluginArtifacts(), getCompileSourceRoots().
      • log: org.apache.maven.plugin.logging.Log β†’ org.apache.maven.api.plugin.Log. debug/info/warn/error with CharSequence and/or Throwable, and isXxxEnabled(), are present; the (CharSequence, Throwable) overloads exist too.
      • No session binding before or after; not added.
    • Java engine (Maven-Scripting-Java-Engine): the generated class now imports org.apache.maven.api.Project and org.apache.maven.api.plugin.Log, so $project and $log change type the same way. The engine's compile classpath is ${maven.home}/lib/maven-* plus the test/plugin classpath; on Maven 4 that includes maven-api-core, so it compiles.
    • Groovy scripts using project.artifactId (the 4 Groovy ITs) work unchanged; Groovy property access maps onto the Project getters.
    • Error reporting: MojoExecutionException (script error) and MojoFailureException (no engine for name/extension) both become MojoException, so the "BUILD FAILURE" vs "error" distinction is gone.
    • ContextAwareEngine.setLog(Log) is public API for custom engines: parameter type is now the v4 Log.

    Gaps: none. Everything used has a v4 equivalent.

    Improvements: drops maven-plugin-api, maven-core, maven-plugin-annotations. <prerequisites><maven> follows ${mavenVersion}.

    Recommendation: port; publish as a 4.x line and keep 3.x for Maven 3 users. Release notes must list the binding type change, since user scripts are the only "consumers" and they are not visible to us.

    maven-shade-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally: mvn -B -ntp verify with Maven 4.0.0-rc-7, JDK 21 β†’ 72 unit tests before and after, 0 failures, 0 skipped; mvn verify -Prun-its β†’ Passed 85, Failed 0, Skipped 1 before (19m39s, contended by other builds) and after (13m59s); the skipped IT is MSHADE-185 ("SKIPPED due to JRE version") both times, so the system-scoped-dependency path of the reduced POM is unexercised. spotless:check clean. Shared snapshots consumed: none. Not measured: parallel (-T) builds beyond the existing MSHADE-413-parallel IT, JDK 17.

    Public API changes

    • Shader.shade throws the unchecked org.apache.maven.api.plugin.MojoException instead of checked MojoExecutionException. Third-party Shader implementations break at compile time and need @Named("<hint>") from org.apache.maven.api.di plus an entry in META-INF/maven/org.apache.maven.api.di.Inject (<proc>none</proc> in the parent, so nothing generates it for test classes). DefaultShader is @Named("default") with @Inject on the no-arg constructor.
    • MinijarFilter public constructors: (MavenProject, Log, ...) becomes (String projectId, Path projectArtifact, Path outputDirectory, Map<String,Path> dependencies, Log, ...); Log is org.apache.maven.api.plugin.Log.
    • UseDependencyReducedPom.createPomReplaceTransformers(MavenProject, File) takes org.apache.maven.api.Project; ShadeMojo.updateExcludesInDeps(MavenProject, List, List) becomes (List, List) over org.apache.maven.api.model.Dependency.
    • Removed org.apache.maven.plugins.shade.pom.PomWriter, MavenJDOMWriter (1941 lines) and Counter; the reduced POM is written with ModelXmlFactory.
    • Unchanged: ResourceTransformer, ReproducibleResourceTransformer, Relocator, Filter and every built-in transformer. None references a Maven type, so third-party transformers recompile as they are (MSHADE-363_old-Transformer passes with a Spring Boot transformer on the plugin classpath). jdom2 and plexus-utils stay because built-in transformers use them.
    • ShadeMojo implements org.apache.maven.api.plugin.Mojo with @Inject Log/Session/Project/Map<String,Shader>; new package-private ResolvedArtifact replaces org.apache.maven.artifact.Artifact inside the mojo.

    Gaps

    • The project's POM file cannot be replaced. v3 called MavenProject.setFile(dependencyReducedPom); Project has no setter, and ArtifactManager.setPath(project.getPomArtifact(), drp) has no effect on install (tried: installed -build.pom still lists the shaded dependency). The call is dropped. Measured on Maven 4 with the 3.6.3 plugin: setFile only changed the installed *-build.pom; the consumer POM (*.pom) is generated from the model and still lists the shaded dependency. So Maven 4 core, not the plugin API, decides what consumers see; a model-level hook would be needed.
    • Main artifact replacement needs no v4 call: the mojo renames the shaded file over the path from ArtifactManager.getPath(project.getMainArtifact()). Attached artifacts use ProjectManager.attachArtifact(project, session.createProducedArtifact(g, a, v, classifier, ext, null), path); classified sources/tests resolve through session.resolveArtifact(coordinates, projectManager.getRemoteProjectRepositories(project)). getMainArtifact() is empty for pom packaging.
    • ProjectBuilder cannot re-read the reduced POM: DefaultProjectBuilder.doBuild builds a bare ProjectBuildingRequest (no root directory, properties or profiles), so a parent reachable only through relativePath fails with "Non-resolvable parent POM" (dep-reduced-pom-with-local-parent). The port collects the dependencies it just wrote (DependencyResolverRequest with rootArtifact, dependencies, managedDependencies, verbose(true), TEST_RUNTIME) instead. Consequences: the written POM is no longer parsed back, so a malformed reduced POM is no longer caught in the plugin, and the MSHADE-467 lock around the build is gone.
    • DependencyCoordinatesFactory.create(Session, org.apache.maven.api.model.Dependency) drops scope, optional and exclusions (it passes only g:a:v:classifier:type). With it the graph lost provided and the exclusions and dep-reduced-pom-artifactset-provided-excludes (MSHADE-311) failed. The mojo fills DependencyCoordinatesFactoryRequest itself and implements api.Exclusion.
    • No threadSafe and no requiresDependencyResolution on @Mojo: dependencies are resolved in execute() with DependencyResolver.resolve(session, project, PathScope.MAIN_RUNTIME); getDependencies() is a LinkedHashMap, so jar order (first wins on duplicate resources) is kept. No IT isolates the ordering.
    • MavenProject.getOriginalModel() has no equivalent; the raw model is read from project.getPomPath() with ModelXmlFactory (strict(false)).
    • DI: injecting Shader picks an arbitrary implementation once a build adds another (shading-with-java-8-sources has the test jar with MockShader on the plugin classpath and sets no shaderHint, and it ran MockShader); the mojo injects Map<String,Shader> and looks up shaderHint or default. A class with two constructors needs @Inject on one.
    • Parameter default ${basedir}/dependency-reduced-pom.xml does not evaluate in v4 (created a literal ${basedir} path); now ${project.basedir}/..., same value.
    • Reduced-POM parent.relativePath (Set <relativePath/> in dependency-reduced-pom.xml to avoid false parent cycle in Maven 4Β maven-shade-plugin#813, [MNG-7602] Move back model version from 5.0 to 4.2 and reactivate modello site generationΒ #843, both open): master does not fix it. On rc-7 a project with <relativePath/> in its parent fails at shade with 'parent.relativePath' ... points at 'pom.xml' which resolves to org.example:app-emptyrel instead of the declared parent; the .. layout from Make sure RAT plugin ignores files in the target folderΒ #813 did not fail on rc-7 with master's code in my repro. Root cause: the 3.x code resolves an empty relativePath against the basedir and writes pom.xml. The port keeps an empty path empty, and leaves an unset path unset: the v4 model writer writes every non-null field, so writing the computed ../pom.xml made Maven 4 reject the reduced POM (verified with mvn -f dependency-reduced-pom.xml validate). Not the approach of [MNG-7602] Move back model version from 5.0 to 4.2 and reactivate modello site generationΒ #843 (empty path when .. is not the real parent); that PR's case and mine are different inputs.
    • Unverified: parallel builds, generateUniqueDependencyReducedPom under load, MSHADE-185 system scope (IT skipped), mojo configuration of third-party transformers that need injection.

    User-visible changes

    • Runs on Maven 4 only and needs Java 17; a 3.x line must stay for Maven 3 users. Goal, parameter names and -D properties are unchanged; threadSafe is not declared.
    • Reduced POM is written by the v4 model writer: canonical element order, https://maven.apache.org/xsd/maven-4.0.0.xsd in schemaLocation, default values (<relativePath>../pom.xml) omitted; all reduced-POM ITs pass.
    • Install/deploy publish the original *-build.pom (on Maven 4 the 3.6.3 plugin published the reduced one there); the consumer POM is unchanged by either.
    • <relativePath/> in the shaded project's parent now works on Maven 4 (fails on master).
    • Consumers in the Apache Maven repositories that use the plugin (indexer-cli, resolver-ant-tasks, surefire-shared-utils, surefire-shadefire, doxia converter, modello-core) reference only built-in transformers by class name; no source change, but each needs the new plugin version under Maven 4. Maven 4's mvnup (PluginUpgradeStrategy) upgrades shade to at least 3.5.0 and skips projects with custom transformers; it knows nothing of 4.x.

    Improvements: drops maven-plugin-api, maven-core, maven-model, maven-artifact, maven-resolver-provider, maven-plugin-annotations, javax.inject, sisu-maven-plugin, and about 2000 lines of generated JDOM writer; adds maven-api-core, maven-api-di, maven-api-model, maven-api-annotations (provided). Test scope: junit-vintage-engine, junit (explicit) and maven-plugin-testing-harness go; guice is added for TransformerTesterRule (sisu.plexus needed it and maven-core no longer supplies it); junit/hamcrest-core stay in dependencyManagement because xmlunit-legacy pulls junit 4 in and surefire then starts the vintage engine.

    Tests rewritten, none removed: ShadeMojoTest (5 tests) from JUnit 3 AbstractMojoTestCase to JUnit 5 with Mockito and new DefaultShader(); MinijarFilterTest (2 tests) from a MavenProject mock to the new constructor. 72 tests before and after. New src/test/resources/META-INF/maven/org.apache.maven.api.di.Inject lists MockShader.

    Recommendation: port for the Maven 4 line, keep 3.x for Maven 3. Two things block a full-parity claim: the reduced POM cannot become the published POM through any v4 API (a core/consumer-POM question to raise on apache/maven), and the ProjectBuilder request cannot carry session context. Worth issues: DependencyCoordinatesFactory.create(Session, model.Dependency) dropping scope/exclusions, and ProjectBuilderRequest lacking root directory/properties. Consider folding the <relativePath/> fix into a 3.x PR against #813/#843 first, since master is broken for that input today.

    maven-toolchains-plugin: ported

    Branch agent/mvn4-api; PR not opened yet. Status: ported, 4.0.0-beta-1-SNAPSHOT, Java 17. All four goals on org.apache.maven.api; no test or IT removed.

    Verified locally: Maven 4.0.0-rc-7, JDK 21. mvn -B -ntp verify: 1 test (ToolchainDiscovererTest), 0 failures, before and after. -Prun-its: 8 of 8 ITs before (old plugin on Maven 4), 8 of 8 after. display-discovered-jdk-toolchains and generate-jdk-toolchains-xml have no IT; both were run by hand against the built plugin and print/write the 5 local JDKs. Spotless clean.

    Do the goals still have a job under Maven 4? Yes, both toolchain and select-jdk-toolchain. rc-7 DefaultToolchainManager only stores and reads the build context (toolchain-<type>); nothing in core selects and stores a toolchain. Core points at this plugin: checkJdkSourceLevelCompatibility logs "run 'mvnup' to add the maven-toolchains-plugin" and mvnup ToolchainPluginStrategy adds select-jdk-toolchain.

    Public API changes

    • Mojos implement org.apache.maven.api.plugin.Mojo with @Inject Log/Session (org.apache.maven.api.di); requiresProject = false becomes projectRequired = false; defaultPhase is a string. Goal names and parameter names/properties unchanged.
    • ToolchainManagerPrivate becomes session.getService(ToolchainManager.class) (getToolchains, storeToolchainToBuildContext); ToolchainPrivate becomes org.apache.maven.api.Toolchain; toolchains XML goes through ToolchainsXmlFactory; models are the immutable org.apache.maven.api.toolchain types with XmlNode configuration.
    • ToolchainsRequirement (public) keeps its getters; its package-private field is replaced by fromXmlNode(XmlNode). ToolchainConverter and ToolchainsComponentConfigurator (Plexus converter plus custom configurator toolchains-requirement-configurator) are deleted: the toolchains parameter is now an XmlNode, which rc-7's enhanced configurator populates directly (confirmed by the toolchain ITs).
    • ToolchainDiscoverer is an api.di @Named @Singleton with a constructor taking ToolchainsXmlFactory (was no-arg); it is public, so callers constructing it break.
    • Discovery no longer aborts on one unreadable JDK: a JDK whose java -XshowSettings fails is skipped (before, the NPE was caught and discovery returned an empty result).
    • The cache and generated toolchains XML now use the 1.2.0 toolchains namespace (writer of rc-7).

    Gaps

    • No API turns a ToolchainModel into a Toolchain for an arbitrary model: the jdk ToolchainFactory is not bound in a plugin's injector (No binding ... @Named("jdk") ToolchainFactory). select-jdk-toolchain therefore wraps discovered and current JDK models in a private JdkToolchain (type, model, findTool); storeToolchainToBuildContext only uses type and model, and core re-creates the real toolchain from the stored model.
    • RequirementMatcherFactory is compat-only. Matching is done locally on model.getProvides(): version through session.parseVersionConstraint(..).contains(session.parseVersion(..)), env by the existing regex, everything else case-insensitive equals. The jdk factory's own matcher also does not know env, so toolchain.matchesRequirements could not have been reused.
    • Xpp3Dom replaced by XmlNode (child("jdkHome").value()); the plugin no longer needs plexus-xml.
    • No generated-by-processor surprises: <proc> is on; the META-INF/maven/org.apache.maven.api.di.Inject index lists the four Mojo factories and ToolchainDiscoverer.
    • Custom toolchain types: a v4 services.ToolchainFactory contributed by an extension is found by the core manager only when it is registered through the Sisu index (javax.inject.@Named("custom") plus sisu-maven-plugin:main-index), not through META-INF/maven/org.apache.maven.api.di.Inject alone (Missing toolchain factory for type: custom with the api.di index). The IT fixture setup-custom-toolchain is ported that way.

    User-visible changes

    • Requires Maven 4 (<prerequisites> follows mavenVersion 4.0.0-rc-7).
    • Failure messages carry MojoException instead of MojoFailureException (IT missing-toolchain assertion updated).
    • The toolchains parameter is logged at debug level as XML, not ToolchainsRequirement{...} (IT select-jdk-toolchain-range now asserts the Required toolchain: info line instead).
    • Custom toolchain factories written against the compat ToolchainFactory still work through core's bridge; ones written for the v4 API need the Sisu index, see Gaps.

    Improvements: drops maven-core, maven-plugin-api, maven-plugin-annotations, javax.inject, org.eclipse.sisu.plexus, plexus-xml, slf4j-api 1.7 (now provided 2.0.x) and sisu-maven-plugin.

    Recommendation: merge-worthy as the 4.x line, with the jdk-factory and env matcher gaps filed against apache/maven: a way to create a Toolchain from a ToolchainModel would remove the private JdkToolchain wrapper.

    maven-changes-plugin: partial

    Branch agent/mvn4-api; PR not opened yet. Status: partial, 4.0.0-beta-1-SNAPSHOT, Java 17.

    Verified locally (Maven 4.0.0-rc-7, zulu-21, plugin-tools 4.0.0-beta-3, plugin-testing 4.0.0-beta-4):

    • before mvn -B -ntp verify: 58 tests run, 0 failures, 0 errors, 1 skipped; BUILD SUCCESS. -Prun-its -DskipTests: 16 ITs, Passed 16, Failed 0, 1m40s.
    • after mvn -B -ntp verify -Prun-its: 54 tests run, 0 failures, 0 errors, 1 skipped; ITs Passed 16, Failed 0 (11 new, 5 kept); BUILD SUCCESS. spotless:check, RAT and dependency:analyze ran in the same build and pass.
    • 4 tests no longer run (FeedGeneratorTest 2, JiraChangesReportTest 1, JiraUnicodeTestCase 1: all exercise the excluded report classes) and 11 report ITs are not selected (see Gaps). Negative control: changing one expected subject in announce-mail-sender-parameter/verify.groovy makes that IT FAIL.

    What ported. Non-report goals announcement-generate, announcement-mail, changes-check, changes-validate are v4 mojos (org.apache.maven.api.plugin.Mojo, @Inject Project/Session/Log, MojoException). The report goals (changes, jira-changes, github-changes, trac-changes as @Mojo report names, plus the deprecated changes-report, jira-report, github-report, trac-report) are blocked: their sources stay in the tree and are excluded from compilation (maven-compiler-plugin <excludes>/<testExcludes> with a comment), because plugin-tools 4.0.0-beta-3 writes <requirements> from the @Component fields of AbstractMavenReport into the 2.0.0 plugin.xml and rc-7 then rejects every goal of the plugin (proven for maven-pmd-plugin; not re-run here). The reporting chain (site plugin 3.x cast error, reporting-impl needing maven-core) is proven in the maven-changelog-plugin findings.

    Proved by real Maven 4 runs (ITs, invoker, through the existing run-its profile)

    • announcement-generate from changes.xml, with the five pre-existing ITs (plain, custom template plus changes-validate, three failure cases for issue management) and announce-generate-project-values, which prints every expression-derived value into a custom template and checks it.
    • announcement-generate from JIRA (announce-generate-jira, wiremock): the jira server in src/it/settings.xml has an encrypted password (master password from settings-security.xml). The mock only answers the search after the session login with the decrypted jira-password, so Session.getSettings() returns decrypted server passwords in a real build; the SettingsDecrypter injection is not needed.
    • announcement-mail (announce-mail, announce-mail-sender-parameter) against a fake SMTP server started in setup.groovy: the v4 @Execute(goal = "announcement-generate") fork runs first and its output is the mail body; sender from <developers> by fromDeveloperId, from a <mailSender> bean parameter, cc list, subject default. The Geronimo transport opens one SMTP session per recipient (3 messages for 2 to + 1 cc), the old code did too.
    • changes-check (valid, invalid date, relative xmlPath, relative invalid, skipSnapshots) and changes-validate (failOnError true fails with changes.xml file is not valid: ...: SAXException, false only warns).
    • Not proven: GitHub and Trac issue sources (no offline route; GitHubDownloader has a unit test with a mocked Project), the proxy path of RestJiraDownloader, runOnlyAtExecutionRoot under a multi-module reactor, -T.

    Public API changes

    • Mojo bases: AbstractChangesMojo no longer extends AbstractMojo but implements org.apache.maven.api.plugin.Mojo; project is org.apache.maven.api.Project (@Inject), getLog() is the v4 Log; parameters basedir (${basedir}) and mavenSession removed; isThisTheExecutionRoot() is project.isTopProject().
    • ChangesCheckMojo, ChangesValidatorMojo, AnnouncementMojo, AnnouncementMailMojo: @Mojo is org.apache.maven.api.plugin.annotations.Mojo (threadSafe dropped, no v4 attribute); constructor injection (ChangesValidatorMojo(ChangesSchemaValidator), AnnouncementMojo(VelocityComponent, SettingsDecrypter)) replaced by field @Inject (the generated v4 factory calls the no-arg constructor).
    • AnnouncementMojo/AnnouncementMailMojo: MavenProject project and Settings settings parameters gone; AnnouncementMailMojo.getFrom/setFrom/getProject/setProject removed (developers come from project.getModel().getDevelopers()).
    • ChangesXML, ReleaseUtils, IssueUtils, IssueManagementSystem, JqlQueryBuilder, JiraHelper, RestJiraDownloader, GitHubDownloader, TracDownloader, ProjectUtils: Log is org.apache.maven.api.plugin.Log, exceptions are MojoException (was MojoExecutionException/MojoFailureException), MavenProject becomes org.apache.maven.api.Project, Settings/Server/Proxy become org.apache.maven.api.settings.*.
    • GitHubDownloader.configureAuthentication(SettingsDecrypter, String, Settings, Log) is now (String, Settings, Log); RestJiraDownloader.setSettingsDecrypter removed.
    • IssueAdapter.getReleases(List<Issue>) is now getReleases(List<Issue>, Session): org.apache.maven.artifact.versioning.ComparableVersion is not in the v4 API, Session.parseVersion replaces it.
    • ProjectJavamailMailSender no longer extends org.codehaus.plexus.mailsender.AbstractMailSender (its base AbstractLogEnabled needs plexus-container-default/sisu-plexus, not available to a v4 plugin); it is a standalone class with the same setters and send(MailMessage); initialize() and the ConsoleLogger wiring stay out of the mojo.
    • Version 3.0.0-M4-SNAPSHOT to 4.0.0-beta-1-SNAPSHOT; javaVersion 17; mavenVersion 4.0.0-rc-7; <prerequisites><maven> is ${mavenVersion}; plugin-tools 4.0.0-beta-3; plugin-testing 4.0.0-beta-4; slf4j-api 1.7.36 to 2.0.20.

    Gaps

    • Report goals blocked (plugin.xml <requirements> parse error plus the proven reporting chain). Not ported, not running. Affected: ChangesReport, JiraChangesReport, GitHubChangesReport, TracChangesReport, the three *DeprecatedReport aliases, AbstractChangesReport, ChangesReportRenderer, FeedGenerator (RSS/Atom, imports Doxia), AbstractIssuesReportRenderer, IssuesReportRenderer, IssuesReportHelper. They also use MavenProject.getCollectedProjects() (aggregate report) and MavenFileFilter (changes.xml interpolation), for which no route was checked.
    • The 11 report ITs (report-*) run clean site and are not selected (<pomIncludes> in the run-its profile is announce* and changes-*).
    • No settings decrypt service in the API: passwords arrive decrypted only because Maven 4 decrypts Settings itself. A {...} value that fails to decrypt is used as given, where SettingsDecrypter reported SettingsProblems that the old code logged (log.error). That logging is gone.
    • Project has no route to the Velocity/Plexus container: VelocityComponent (a Plexus component) is replaced by a VelocityEngine the mojo builds with the same properties (classpath,file loaders, IncludeRelativePath, space_gobbling=bc, read from the plexus-velocity 2.4.0 bytecode). Reverse-engineered, will drift if plexus-velocity changes.
    • Expression traps, all hit and fixed by IT: ${project.name} and ${project.packaging.type} are left literal (use ${project.model.name}, ${project.model.packaging}); ${project.description} and ${project.url} were switched to ${project.model.description}/${project.model.url} without testing the short form; ${basedir} is not expanded (${project.basedir}); @Parameter(property = "project.artifactId") no longer reads the project (defaults ${project.artifactId} and ${project.groupId} work).
    • toAddresses/ccAddresses/bccAddresses (List<Object>) and the mailSender bean convert correctly in rc-7 (IT), Map<Object,Object> announceParameters too.
    • project in the Velocity context is now org.apache.maven.api.model.Model (project.getModel()), not MavenProject: $project.name, $project.version, $project.properties still resolve, $project.basedir, $project.build, $project.artifact do not.
    • MojoException has no failure/error split; output reads the same.
    • A relative File parameter (xmlPath=custom/my-changes.xml) resolves to the project's file (IT changes-check-relative-xmlpath); the invoker runs from the project directory, so basedir versus working directory is not distinguished.
    • Runtime dependencies plexus-mail-sender-javamail/-simple are kept unchanged (MCHANGES-463 marks them for removal); javax.mail 1.4 and activation come with the first, and SMTP sending works in the IT with them present. Whether they can go now was not tested.

    User-visible changes

    • Requires Maven 4.0.0-rc-7+ and Java 17 (was Maven 3.6.3 / Java 8); not usable on Maven 3.
    • Goals no longer in the artifact: the four report goals (changes, jira-changes, github-changes, trac-changes) and the deprecated changes-report, jira-report, github-report, trac-report. <reporting> entries for the plugin and the HTML/RSS output of mvn site are gone.
    • Custom announcement templates: $project is the effective POM Model (see Gaps).
    • announcement-generate default parameters now use ${project.model.*}; unchanged names, properties and defaults otherwise (changes.version, changes.xmlPath, changes.announcementFile, changes.template, changes.templateDirectory, changes.jiraServerId, githubAPIServerId, ...). xmlPath default is ${project.basedir}/src/changes/changes.xml for all four goals.
    • announcement-mail: project.developers is no longer a (read-only) parameter; changes.sender, mailSender, fromDeveloperId behave as before.
    • threadSafe flag not declared on the mojos.
    • @Execute(goal = "announcement-generate") on announcement-mail still forks (v4 annotation, IT).

    Improvements

    • Runtime dependencies dropped: maven-core/artifact/model/plugin-api/settings/settings-builder (now maven-api-core/model/settings/di/annotations, provided), maven-plugin-annotations, javax.inject, org.eclipse.sisu.plexus, maven-reporting-api/impl, maven-filtering, plexus-velocity, doxia-core/sink-api, rome, commons-collections4, sisu-maven-plugin. Test side: Maven 3 resolver 1.9.27 artifacts and Mockito 4 replaced by maven-impl/maven-core/guice/Mockito 5 for the v4 harness.
    • 11 new ITs on the non-report goals, including a wiremock JIRA announcement with an encrypted server password and an SMTP mail round trip.

    Recommendation

    Land the four non-report goals as a v4 slice and leave the reports on the 3.x line (or a separate artifact) until maven-site-plugin, maven-reporting-impl and doxia-sitetools have v4 releases. Before merge: decide whether $project in custom templates should stay a Model, and file a settings-decrypt request in apache/maven so the un-decrypted-value case can be reported again.

    maven-project-info-reports-plugin: blocked

    Branch agent/mvn4-api; PR not opened yet. Status: blocked, no port attempted (all 16 goals are report goals), 4.0.0-beta-1-SNAPSHOT would be the version, Java 17. The worktree is unchanged beyond the CI commit; the experiments ran in scratch copies.

    Verified locally (Maven 4.0.0-rc-7, zulu-21), unported plugin on the Build with Maven 4 only commit:

    • mvn -B -ntp verify β†’ 31 tests run, 0 failures, 0 errors, 0 skipped; BUILD SUCCESS.
    • -Prun-its -DskipTests β†’ 25 ITs, Passed 25, Failed 0, Skipped 0, 2m35s (26 directories under src/it, one is the shared settings file).
    • After: nothing changed, same numbers by construction. The 3.x plugin runs under Maven 4 and its ITs pass there, so the ITs do not show a port problem; the compile failure below is the measurement.

    Why there is nothing to port. The plugin has 16 goals and every one extends AbstractProjectInfoReport β†’ AbstractMavenReport, so there is no non-report goal to ship and the report block is proven elsewhere: maven-site-plugin 3.22.0 on rc-7 only accepts Maven 3 mojos as reports (Cannot cast ...ReportFactory to org.apache.maven.plugin.Mojo, maven-changelog-plugin and maven-reporting-impl findings), and a v4 report mojo in the same artifact as v3 ones makes plugin-tools 4.0.0-beta-3 write <requirements> into the 2.0.0 plugin.xml, which rc-7 rejects for every goal (maven-pmd-plugin). Neither was re-run here.

    Measured compile gap

    A trial conversion: pom on maven-api-core/di/annotations/model/settings 4.0.0-rc-7, Java 17, maven-reporting-impl 5.0.0-SNAPSHOT (local v4 port), doxia-integration-tools 3.0.0-SNAPSHOT, sources unchanged. mvn compile β†’ 610 distinct compile errors in 24 files (javac stops after symbol resolution, so type errors behind them are not yet counted): 156 package ... does not exist, 447 cannot find symbol. Packages that no longer exist, by number of import errors: org.apache.maven.project 52, org.apache.maven.plugins.annotations 27, org.apache.maven.model 27, org.apache.maven.artifact 13, org.apache.maven.plugin.logging 8, org.apache.maven.artifact.versioning 6, org.apache.maven.settings 5, org.apache.maven.artifact.handler.manager 4, org.apache.maven.artifact.resolver.filter 3, org.apache.maven.artifact.handler 3, org.apache.maven.execution 2, org.apache.maven.artifact.repository 2. Worst files: PluginsReport 67, DependenciesRenderer 57, PluginManagementReport 57, DependencyManagementRenderer 53, DependencyConvergenceReport 45, ModulesReport 38, TeamReport 36.

    One concrete error per blocked category:

    Category Error v4 route
    Base class on the Maven 3 API with maven-reporting-impl 4.0.0 and only v4 dependencies: AbstractProjectInfoReport.java:[57,57] cannot access org.apache.maven.plugin.AbstractMojo / class file for org.apache.maven.plugin.AbstractMojo not found reporting-impl 5.0.0-SNAPSHOT port exists, but blocked at runtime (missing MavenSession, site plugin cast error)
    Base class hides what the reports read against the 5.0.0-SNAPSHOT port: IndexReport.java:[86,17] siteTool has private access in org.apache.maven.reporting.AbstractMavenReport, same in ModulesReport:85; reactorProjects is gone (used in AbstractProjectInfoReport, DependencyConvergenceReport, IndexReport, ModulesReport) getSiteTool() and getReactorProjects() exist in the port
    MavenProject, ProjectBuilder, ProjectBuildingRequest, DefaultProjectBuildingRequest, MavenSession, MojoExecution package org.apache.maven.project does not exist (52 imports); SummaryReport.java:[160,73] incompatible types: org.apache.maven.api.Project cannot be converted to org.apache.maven.project.MavenProject Project, Session, ProjectBuilder service exist; mechanical except the next row
    Project of a repository artifact v3 projectBuilder.build(pluginArtifact, buildRequest) (PluginsReport:237, PluginManagementReport:256, dependency licenses). Probe against rc-7: ProjectBuilderRequest.builder().session(s).artifact(a) β†’ cannot find symbol: method artifact(Artifact); the builder has only path(Path)/source(Source)/repositories(...) none directly; resolve the POM with ArtifactResolver and build from the path (dependency-plugin findings: Project.getParent() is empty for repository parents, so inherited license/url/organization of a plugin or dependency are lost)
    Maven 3 model classes package org.apache.maven.model does not exist (27); used: Model, Developer, Contributor, License, Scm, IssueManagement, CiManagement, Notifier, MailingList, DistributionManagement, Site, Organization, Plugin, ReportPlugin, PluginManagement, Dependency org.apache.maven.api.model.*, immutable; read-only use here so mechanical
    Settings, Proxy, Server (ProjectInfoReportUtils, LicensesReport) probe: s.getSettings().getActiveProxy() β†’ cannot find symbol: method getActiveProxy() session.getSettings().getProxies() filtered by isActive(); no decrypt service (see gpg/changes findings)
    Artifact, handler, version range (Artifact, DefaultArtifact, ArtifactHandlerManager, VersionRange, ArtifactVersion, ArtifactFilter, ScopeArtifactFilter, StrictPatternIncludesArtifactFilter) package org.apache.maven.artifact.handler.manager does not exist; PluginsReport builds DefaultArtifact plus VersionRange for each plugin TypeRegistry.require(type), Session.resolveVersionRange, Session.parseVersion*; maven-common-artifact-filters 4.0.0-SNAPSHOT port uses Predicate<Dependency>
    Dependency graph (DependenciesReport:197, DependencyConvergenceReport:854) call sites buildDependencyGraph(ProjectBuildingRequest, ArtifactFilter) / collectDependencyGraph(buildingRequest, filter); the maven-dependency-tree 4.0.0-SNAPSHOT port only has (Session, Project, Predicate<Dependency>) port exists; getParent() is kept by the port; the convergence report lists versions that conflict, and conflict winner and omitted-version data exist only inside Node.asString() per the dependency-tree findings, so DependencyConvergenceReport has no structured route (not run)
    Jar analysis (DependenciesReport injects JarClassesAnalysis) javax.inject component; the shared-jar port moved to org.apache.maven.api.di, so under Maven 3 it is not found, and under v4 the hand-kept DI index applies port exists (maven-shared-jar PR #182)
    Plexus/Sisu components (I18N, SiteTool, ScmManager, ArtifactHandlerManager, RepositorySystem) ctor injection of every report: AbstractProjectInfoReport(RepositorySystem, I18N, ProjectBuilder); v4 DI gives No binding to construct an instance for key ScmManager/SiteTool (changelog and reporting-impl findings) Lookup.lookup(...) for ScmManager (scm-publish port needed a hand-built ScmManagerFactory); I18N can be replaced by ResourceBundle; RepositorySystem has no plugin-visible route (dependency-tree findings)
    @Mojo(requiresDependencyResolution = TEST) package org.apache.maven.plugins.annotations does not exist (27) v4 @Mojo has dependencyResolutionPathScopes; plugin-tools writes no <resolutions>, so DependencyResolver must be injected
    maven-archiver BuildHelper (SummaryReport:160-169) 3.6.6 takes MavenProject (error above) master of maven-archiver is already on the v4 API (PR #416 comment)

    Per report: Maven 3 API needed beyond the base class, and v4 route

    Goal Maven 3 API v4 route Difficulty
    issue-management, ci-management, mailing-lists, distribution-management model getters only (IssueManagement, CiManagement, Notifier, MailingList, DistributionManagement), Log Project.getModel() mechanical
    dependency-info none beyond base none needed mechanical
    team Developer, Contributor, MavenProject model mechanical; avatars need no Maven API
    licenses License, Settings proxy/server through ProjectInfoReportUtils for URL checks model + Session.getSettings() mechanical plus one rewrite (getActiveProxy)
    summary BuildHelper, Organization, Plugin archiver master (v4) mechanical once archiver is a dependency
    index SiteTool, ArtifactRepository, ProjectBuildingRequest sitetools port 3.0.0-SNAPSHOT (Session, Project) blocked on SiteTool being a Sisu component: no DI binding
    modules SiteTool, ProjectBuilder per module, DistributionManagement/Site ProjectBuilder.build(Session, Path) plus sitetools blocked on SiteTool like index; per-module build from Project.getBasedir() should work
    scm ScmManager, Git/Hg/Svn provider repository classes (maven-scm 2.2.1), Scm Lookup or a hand-built manager, as in the scm-publish port blocked: maven-scm is not on the v4 API and is Sisu-only
    dependencies DependencyGraphBuilder, JarClassesAnalysis, RepositorySystem artifact resolution (RepositoryUtils), ProjectBuilder for dependency POMs, Artifact everywhere dependency-tree and shared-jar ports, ArtifactResolver, POM build from resolved file hard: DependenciesRenderer (1351 lines), DependencyManagementRenderer (373) and Dependencies (294) use Artifact/MavenProject; parent-inherited licenses are lost
    dependency-management ArtifactHandlerManager, RepositorySystem VersionRangeRequest, ProjectBuilder for licenses TypeRegistry, Session.resolveVersionRange, POM build hard (373-line renderer), same license gap
    dependency-convergence (aggregator) DependencyCollectorBuilder verbose graph, graph filters and visitors, reactor projects dependency-tree port, session.getProjects() blocked on conflict data (see table): the report's content is the set of conflicting versions
    plugins, plugin-management ProjectBuilder.build(Artifact, ...) for each plugin, ArtifactHandlerManager, VersionRange, DefaultArtifact, ReportPlugin no artifact-based project builder (probe error) hard: needs POM resolve plus build, inherited data lost

    Public API changes

    None made. A port would drop maven-core/maven-artifact/maven-model/maven-plugin-api/maven-settings/maven-resolver-api and Sisu, change every report constructor (RepositorySystem, I18N, ProjectBuilder injection), and stop accepting ${project}/${session} as parameters.

    Gaps

    • Every goal is a report: no non-report slice exists (contrast maven-pmd-plugin, maven-changes-plugin).
    • No Maven 4 route for a project built from a repository artifact, for Project.getParent() of such a project, for conflict data on api.Node, for a plugin-visible RepositorySystem, for Sisu components (SiteTool, ScmManager, I18N).
    • Not measured: a run of any report on rc-7; the runtime behaviour of the dependency-tree, shared-jar and sitetools ports from this plugin; whether the org.apache.maven.api.di.Inject index is enough for JarClassesAnalysis in this plugin.
    • The 25 ITs (full-pom, multi-module, ...) are the only real coverage of the rendered output; none can run against a v4 report until the site plugin accepts one.

    User-visible changes

    Not applicable: no change made. A port would require Maven 4.0.0-rc-7+, Java 17, and produce no report until maven-site-plugin, maven-reporting-impl and doxia-sitetools have v4 releases.

    Improvements

    None claimed. Dependencies a port would drop are listed above; measured effect none.

    Recommendation

    Keep the plugin on 3.x; it runs unchanged under Maven 4 (31 tests, 25 of 25 ITs pass). Revisit after the chain doxia-sitetools β†’ maven-site-plugin β†’ reporting-impl lands. When it does, port in three steps: (1) the eleven model-only or light reports (issue-management, ci-management, mailing-lists, distribution-management, dependency-info, team, licenses, summary, index, modules, scm after a maven-scm decision), (2) dependencies and dependency-management once a repository-artifact project builder (or an api route for parent-inherited POM data) exists, (3) dependency-convergence and plugins/plugin-management last. Upstream asks that this measurement supports: ProjectBuilderRequest.artifact(...), structured conflict data on api.Node, a non-Sisu way to get SiteTool and I18N.

  21. slachiewicz commented on Sep 30, 2026

    @slachiewicz
    MemberAuthor

    Maven 4.0.0 is not out: cannot we wait a little bit before creating double maintenance? I know it is funny to use AI and burn tokens, but it's not funny to augment the maintenance
    @hboutemy its to validate where we are with Maven 4 API, if we have some blockers, missing features. Looking at results - I don't have apetite to release any new Maven 4 only component/plugin but few design things we need to take.
    Next step after collecting results, in pararel to design decisions is to simplify/move away from deprecated or soon to be deprecated iun V3 api to simplify future Maven 4 migration.
    For Doxia i've identifued also few points that needs more effort.
    I also remember about Your's proposal to move V4 from master to the dedicated branches to focus on V3 improvements instead (to run on Maven 3.10 and Maven 4)

  22. self-assigned this
    on Sep 30, 2026
  23. added theissue type on Oct 5, 2026
  24. removed theissue type on Oct 7, 2026
  25. added theissue type on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions