AlexanderAshitkin commented on code in PR #177:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/177#discussion_r1732068731


##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -228,20 +232,35 @@ private CacheRestorationStatus restoreProject(
             // Verify cache consistency for cached mojos
             LOGGER.debug("Verify consistency on cached mojos");
             Set<MojoExecution> forcedExecutionMojos = new HashSet<>();
+            Set<MojoExecution> reconciliationExecutionMojos = new HashSet<>();
             for (MojoExecution cacheCandidate : cachedSegment) {
                 if (cacheController.isForcedExecution(project, 
cacheCandidate)) {
                     forcedExecutionMojos.add(cacheCandidate);
                 } else {
+                    if (!reconciliationExecutionMojos.isEmpty()) {
+                        reconciliationExecutionMojos.add(cacheCandidate);
+                        continue;
+                    }
                     if (!verifyCacheConsistency(
                             cacheCandidate, build, project, session, 
mojoExecutionRunner, cacheConfig)) {
-                        LOGGER.info("A cached mojo is not consistent, 
continuing with non cached build");
-                        return CacheRestorationStatus.FAILURE;
+                        if 
(!cacheConfig.isIncrementalReconciliationOnParameterMismatch()) {
+                            LOGGER.info("A cached mojo is not consistent, 
continuing with non cached build");
+                            return CacheRestorationStatus.FAILURE;
+                        } else {
+                            LOGGER.info("A cached mojo is not consistent, will 
reconciliate from here");
+                            reconciliationExecutionMojos.add(cacheCandidate);
+                        }
                     }
                 }
             }
 
+            Set<MojoExecution> plannedExecutions = Stream.concat(
+                            forcedExecutionMojos.stream(), 
reconciliationExecutionMojos.stream())
+                    .collect(Collectors.toSet());
             // Restore project artifacts
-            ArtifactRestorationReport restorationReport = 
cacheController.restoreProjectArtifacts(cacheResult);
+            ArtifactRestorationReport restorationReport = 
cacheController.restoreProjectArtifacts(
+                    cacheResult,
+                    !containsExecution(plannedExecutions, 
"org.apache.maven.plugins", "maven-jar-plugin", "jar"));

Review Comment:
   this hardcoded list of plugins doesnt look good and manifests a workaround 
which might not work in general case. What is it for?



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to