Skip to content

Support Resolver 2.x update policy control via CLI#11948

Open
cstamas wants to merge 1 commit intoapache:maven-3.10.xfrom
cstamas:maven-3.10.x-am-policy-cli
Open

Support Resolver 2.x update policy control via CLI#11948
cstamas wants to merge 1 commit intoapache:maven-3.10.xfrom
cstamas:maven-3.10.x-am-policy-cli

Conversation

@cstamas
Copy link
Copy Markdown
Member

@cstamas cstamas commented Apr 14, 2026

Resolver 2.x supports split policies for artifacts and metadata. Introduce 2 new CLI options, that if used, renders old "all" options ignored (-U and -nsu).

Fixes #11918


Explanation: currently Maven had two update policy altering CLI options, -U and -nsu, and former set global session policy to "always" and latter to "never". Since Resolver 2.x update policies for artifacts and metadata are split and are handled as such.

Why it matters:

  • plugin prefix resolution happens via metadata -- "always" policy will refetch only metadata
  • snapshot resolution happens via metadata -- "always" makes sure any new ones are discovered
  • "remembered" 404 for missing artifact happens via artifacts

Before, when user issued -U he triggered all these above (forced refresh). Now, while -U still works, first two can be triggered with --metadata-update-policy=always (or suppress with never), and last one can be triggered with --artifact-update-policy=always without affecting the others (ie. discovery of new snapshots).

Resolver 2.x supports split policies for artifacts and metadata.
Introduce 2 new CLI options, that if used, renders old "all"
options ignored (-U and -nsu).
@cstamas cstamas added this to the 3.10.0 milestone Apr 14, 2026
@cstamas cstamas self-assigned this Apr 14, 2026
@cstamas cstamas added the enhancement New feature or request label Apr 14, 2026
@cstamas cstamas linked an issue Apr 14, 2026 that may be closed by this pull request
@cstamas cstamas marked this pull request as ready for review April 14, 2026 09:56
Comment on lines +114 to +116
public static final String ARTIFACTS_UPDATE_POLICY = "artifacts-update-policy";

public static final String METADATA_UPDATE_POLICY = "metadata-update-policy";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about short version of options?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolver 2 supports split policies for artifacts and metadata

2 participants