slachiewicz opened a new issue, #14001:
URL: https://github.com/apache/maven/issues/14001
### New feature, improvement proposal
These gaps came up when Maven plugins were ported from the Maven 3 API to
the Maven 4 API (see #13302). Each was checked on `maven-4.0.x` and `master` on
2026-11-14, and none has an open issue. This is a list to triage, not a request
to implement all of it: each item can be picked up on its own or rejected. The
design trackers for the surrounding work are #13460 and #13499.
Type and method names below use the `maven-4.0.x` spelling; `master` has
noun-style accessors for the same members (`url()` for `getUrl()`, and so on).
### Repositories and resolution
- [ ] Metadata resolution, repository policies and artifact descriptors.
Replaces the resolver calls `RepositorySystem.resolveMetadata` and
`readArtifactDescriptor`, and the policies of the Maven 3 `ArtifactRepository`.
`RemoteRepository` has only `getId()`, `getUrl()` and `getProtocol()`, so a
plugin cannot read the release or snapshot policy of a repository it was
handed. There is no service that resolves `maven-metadata.xml` with update and
checksum policy (`master` has a read-only `RepositoryMetadata` type used by
repository events) and none that returns an artifact descriptor, so relocation
is re-implemented. Belongs in `org.apache.maven.api.services` and
`RemoteRepository`. Hit in maven-archetype-plugin, maven-resolver-ant-tasks,
maven-dependency-plugin, maven-doap-plugin. Related: #13520 (repository
events), #11255 (relocation behavior).
- [ ] Existence check and remote layout on `Transport`. Replaces
`Wagon.resourceExists` and `ArtifactRepository.pathOf(Artifact)`. `Transport`
has `get`, `getBytes`, `getString` and `put*`, no way to ask whether a resource
exists without downloading it. `Session.getPathForRemoteArtifact` returns the
path in the local cache, not the location in the remote repository, so a plugin
builds `g/a/v/a-v.ext` by hand. Needed by maven-doap-plugin, which now infers
existence from a `.sha1` file. Related: apache/maven-resolver#1224 (update
policy of the resolver's own existence check).
- [ ] `Session.withLocalRepository` cannot change resolver configuration.
Replaces cloning the `RepositorySystemSession` with
`aether.enhancedLocalRepository.split=false`.
`withLocalRepository(LocalRepository)` takes a path and copies the
configuration of the outer session (`AbstractSession` in `maven-impl`), so a
plugin installing into a staging repository gets the split layout of the
invoking build. There is also no helper that merges two `Settings` objects, the
role of the Maven 3 `SettingsUtils.merge`. Needed by maven-invoker-plugin
(MINVOKER-377). Related: #10601 (split repository switch in `settings.xml`).
- [ ] `Artifact`, `ArtifactCoordinates` and `DependencyCoordinates`
factories need a `Session`. Every method of `ArtifactFactory`,
`ArtifactCoordinatesFactory` and `DependencyCoordinatesFactory` takes one, so
helper code and unit tests cannot create coordinates without a full session.
`VersionParser` and `TypeRegistry` already work without one. Needed by
maven-dependency-tree, maven-mapping and maven-surefire-common.
### Project and model
- [ ] Original (pre-interpolation) model on `Project`. Replaces
`MavenProject.getOriginalModel()`. `Project` has `getModel()` only; plugins
re-read the POM file with `ModelXmlFactory`, which returns the file as modified
so far instead of the load-time state. `ModelBuilderResult.getRawModel()`
exists on the builder service but is not reachable from a `Project`. Hit in
maven-release-plugin (nine uses) and maven-enforcer-plugin.
### Mojo configuration and toolchains
- [ ] `${plugin.*}` expressions. Replaces `${plugin}`,
`${plugin.artifactMap}` and `${project.artifactMap}` of the Maven 3
`PluginParameterExpressionEvaluator`. `PluginParameterExpressionEvaluatorV4`
resolves objects under `session.`, `project.`, `mojo.` and `settings.` only, on
both branches. Hit in maven-surefire-plugin, maven-scm-publish-plugin,
maven-changelog-plugin. Related: #13672 (merged; an artifact map on the Maven 3
`MavenProject`, not the evaluator).
- [ ] `ToolchainFactory` is not injectable. Replaces
`ToolchainFactory.createToolchain(ToolchainModel)` from Maven 3 `maven-core`.
The Maven 4 interface in `org.apache.maven.api.services` does not extend
`Service`, and `DefaultToolchainManager` receives the factories as a
`Map<String, ToolchainFactory>`, so a plugin cannot get the `jdk` factory to
turn a `ToolchainModel` into a `Toolchain`. Needed by maven-toolchains-plugin.
Related: #10657 (scope of `ToolchainManager`).
### Session and settings
- [ ] Settings decryption. Replaces `SettingsDecrypter.decrypt` and
`SecDispatcher.decrypt`. No `maven-api-*` module exposes a decrypt service;
`maven-impl` decrypts inside `DefaultSettingsBuilder`. Plugins that need to
decrypt a value of their own, such as a key store password or a passphrase
looked up by server id, rebuild the dispatcher from internal classes of
plexus-sec-dispatcher. Needed by maven-release-plugin, maven-gpg-plugin,
maven-jarsigner-plugin. Related: #6919 (pluggable crypto), #6494 (path of
`settings-security.xml`).
- [ ] Command line options that forked builds need. Replaces
`MavenExecutionRequest` (`isShowErrors()`, user and global settings and
toolchains files). `BuildInvocation` exists on `master` only; it carries goals,
profiles, projects, failure behavior and offline, but not `-e` and not the
files given with `-s`, `-gs`, `-t` and `-gt`. They are parsed into `Options` in
`maven-api-cli`, and nothing hands them to a mojo through `Session`. Needed by
maven-surefire-plugin (`-e` for the forked JVM), maven-javadoc-plugin (nested
Maven runs).
### Not included
These gaps already have an issue, so they are not repeated above:
- a configured mojo instance without execution: #13518
- dependency resolution metadata on `Node`: #13151
- module path dispatch for modular dependencies: #9065
- consumer POM file on the project: #10863
- Sisu components in Maven 4 mojos: #13326 (closed) and #13989
- process execution service: #13895
- `MojoExecution` accessors that differ between 4.0.x and 4.2: #14000
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]