Repository navigation
Feat: Resolver 2.x update policy control via CLI - #11948
Conversation
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).
| public static final String ARTIFACTS_UPDATE_POLICY = "artifacts-update-policy"; | ||
|
|
||
| public static final String METADATA_UPDATE_POLICY = "metadata-update-policy"; |
There was a problem hiding this comment.
What about short version of options?
There was a problem hiding this comment.
I wanted an option like -U is but more versatile:
-mupwould work like-U(set always for metadata)- but optionally, user could set actual policy
-mup neveror-mup always
But the problem with optional support in Commons CLI, is that it does not work like? Or at least I could not make it work, ie CLI like this mvn -mup clean would assume "clean" is a policy and it would explode (unknown policy "clean").
So, I ended up with long options with mandatory param that is nice and explicit --metadata-update-policy=never, and on CLI this is also clear mvn --metadata-update-policy=never clean and it is perfectly clear what is written here.
There was a problem hiding this comment.
Solved; introduced -UA and -UM that is like "half of" -U 😄 And the other two long opts allow user to fine tune policies, ie. use "never" policy on thing he wants.
- Add --UA / --update-artifacts and --UM / --update-metadata CLI flags to force artifact/metadata updates (always policy) - Add --artifacts-update-policy and --metadata-update-policy options for fine-grained update control; supported values: always, daily, interval:N, never, and explicit (new, updates only if not already cached) - Warn when new-style policies are mixed with legacy -U / -nsu flags - New MavenExecutionRequest.setArtifactsUpdatePolicy() / setMetadataUpdatePolicy() API; DefaultRepositorySystemSessionFactory dispatches to new policies when set, falling back to existing -U / -nsu behavior - Port of apache#11948 to maven-4.0.x
- Add --UA / --update-artifacts and --UM / --update-metadata CLI flags to force artifact/metadata updates (always policy) - Add --artifacts-update-policy and --metadata-update-policy options for fine-grained update control; supported values: always, daily, interval:N, never, and explicit (new, updates only if not already cached) - Warn when new-style policies are mixed with legacy -U / -nsu flags - New MavenExecutionRequest.setArtifactsUpdatePolicy() / setMetadataUpdatePolicy() API; DefaultRepositorySystemSessionFactory dispatches to new policies when set, falling back to existing -U / -nsu behavior - Fix jvm.config LF-only handling on Windows (mvn.cmd retry logic) - Port of apache#11948 to master
- Add --UA / --update-artifacts and --UM / --update-metadata CLI flags to force artifact/metadata updates (always policy) - Add --artifacts-update-policy and --metadata-update-policy options for fine-grained update control; supported values: always, daily, interval:N, never, and explicit (new, updates only if not already cached) - Warn when new-style policies are mixed with legacy -U / -nsu flags - New MavenExecutionRequest.setArtifactsUpdatePolicy() / setMetadataUpdatePolicy() API; DefaultRepositorySystemSessionFactory dispatches to new policies when set, falling back to existing -U / -nsu behavior - Port of #11948 to maven-4.0.x
- Add --UA / --update-artifacts and --UM / --update-metadata CLI flags to force artifact/metadata updates (always policy) - Add --artifacts-update-policy and --metadata-update-policy options for fine-grained update control; supported values: always, daily, interval:N, never, and explicit (new, updates only if not already cached) - Warn when new-style policies are mixed with legacy -U / -nsu flags - New MavenExecutionRequest.setArtifactsUpdatePolicy() / setMetadataUpdatePolicy() API; DefaultRepositorySystemSessionFactory dispatches to new policies when set, falling back to existing -U / -nsu behavior - Fix jvm.config LF-only handling on Windows (mvn.cmd retry logic) - Port of #11948 to master
Resolver 2.x supports split policies for artifacts and metadata. Introduce 4 new CLI options, that if used, renders old "all" options ignored (-U and -nsu). New options are:
-UAsimilar to existing-Ubut forces only artifact updates (resolves cached 404)-UMsimilar to existing-Ubut forces only metadata updates (updates ranges and snapshots)--artifacts-update-policy=<policy>and--metadata-update-policy=<policy>) where user can explicitly fine tune override policies for artifacts and metadata.If any of these 4 above are set, the old
-Uis ignored, and if any of-UAor-UMis set, the long counterpart is ignored.Fixes #11918
Explanation: currently Maven had two update policy altering CLI options,
-Uand-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:
Before, when user issued
-Uhe triggered all these above (forced refresh). Now, while-Ustill 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=alwayswithout affecting the others (ie. discovery of new snapshots).