cowwoc commented on code in PR #395:
URL:
https://github.com/apache/maven-build-cache-extension/pull/395#discussion_r3608934098
##########
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:
Addressed in f04d1cc. Validation-time capture raises
LifecycleExecutionException for plugin-configuration failures, while the
missing validation-event invariant raises AssertionError. The save path
verifies that every cacheable mojo has a validation-time event before saving.
Clean-only executions remain intentionally skipped. The PR description and code
snippet match.
--
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]