cowwoc commented on code in PR #395:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/395#discussion_r3608943171


##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -183,9 +197,16 @@ public void execute(
                                     .isEmpty()) {
                         LOGGER.debug("Cache storing is skipped since there was 
no \"clean\" phase.");
                     } else {
-                        final Map<String, MojoExecutionEvent> executionEvents =
-                                mojoListener.getProjectExecutions(project);
-                        cacheController.save(result, mojoExecutions, 
executionEvents);
+                        // Only save cache if there are validation-time events 
to store
+                        // When running only clean phase, there are no 
cacheable mojos
+                        if (result.getValidationTimeEvents() == null
+                                || result.getValidationTimeEvents().isEmpty()) 
{
+                            LOGGER.debug("Skipping cache storage for {} - no 
cacheable mojos executed", projectName);
+                        } else {
+                            LOGGER.debug(
+                                    "Using validation-time properties for 
cache storage (consistent lifecycle point)");
+                            cacheController.save(result, mojoExecutions, 
result.getValidationTimeEvents());
+                        }

Review Comment:
   Correction: the missing validation-event case is an internal invariant and 
now throws AssertionError; LifecycleExecutionException remains reserved for 
plugin-configuration failures. The PR description and code snippet have been 
updated accordingly.



-- 
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]

Reply via email to