[ 
https://issues.apache.org/jira/browse/MRESOLVER-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17731370#comment-17731370
 ] 

ASF GitHub Bot commented on MRESOLVER-369:
------------------------------------------

cstamas commented on code in PR #297:
URL: https://github.com/apache/maven-resolver/pull/297#discussion_r1225863920


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultUpdateCheckManager.java:
##########
@@ -185,7 +224,8 @@ public void checkArtifact(RepositorySystemSession session, 
UpdateCheck<Artifact,
             if (error != null) {
                 check.setException(newException(error, artifact, repository));
             }
-        } else if (isUpdatedRequired(session, lastUpdated, check.getPolicy())) 
{
+        } else if (updatePolicyScope.isApplyToArtifact()
+                && isUpdatedRequired(session, lastUpdated, check.getPolicy())) 
{
             check.setRequired(true);
         } else if (fileExists) {
             LOGGER.debug("Skipped remote request for {}, locally cached 
artifact up-to-date", check.getItem());

Review Comment:
   Here the message may need adjustment: "locally cache artifact is up-to-date" 
(if policyScope applies) ot "local cache artifact is present" (if policyScope 
does not applies and file is present)



##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultUpdateCheckManager.java:
##########
@@ -185,7 +224,8 @@ public void checkArtifact(RepositorySystemSession session, 
UpdateCheck<Artifact,
             if (error != null) {
                 check.setException(newException(error, artifact, repository));
             }
-        } else if (isUpdatedRequired(session, lastUpdated, check.getPolicy())) 
{
+        } else if (updatePolicyScope.isApplyToArtifact()
+                && isUpdatedRequired(session, lastUpdated, check.getPolicy())) 
{
             check.setRequired(true);
         } else if (fileExists) {
             LOGGER.debug("Skipped remote request for {}, locally cached 
artifact up-to-date", check.getItem());

Review Comment:
   Here the message may need adjustment: "locally cache artifact is up-to-date" 
(if policyScope applies) or "local cache artifact is present" (if policyScope 
does not applies and file is present)





> Expose configuration for update check manager where to apply policy
> -------------------------------------------------------------------
>
>                 Key: MRESOLVER-369
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-369
>             Project: Maven Resolver
>          Issue Type: New Feature
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 1.9.11
>
>
> Currently, DefaultUpdateCheckManager ALWAYS applies policy to both, artifacts 
> and metadata. This causes problems when we want to "discover new versions" 
> (or similar use case, that relies on fresh metadata), but metadata is never 
> updated due remote repository update policy of "never", so only -U make it 
> work as expected. -U OTOH is like shooting with cannon onto bird, as it 
> updates many many more as well, not only the one metadata we are interested 
> in.
> Moreover, since Maven3 artifacts are immutable.
> So, add a config like {{aether.updateCheckManager.applyUpdatePolicy}} that 
> accepts values "all" (like today) and "metadata" (does not applies policy to 
> artifacts, if artifact present, no update needed).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to