in src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java [304:353]
private boolean verifyCacheConsistency(
MojoExecution cacheCandidate,
Build cachedBuild,
MavenProject project,
MavenSession session,
MojoExecutionRunner mojoExecutionRunner,
CacheConfig cacheConfig)
throws LifecycleExecutionException {
long createdTimestamp = System.currentTimeMillis();
boolean consistent = true;
if (!cacheConfig.getTrackedProperties(cacheCandidate).isEmpty()) {
Mojo mojo = null;
try {
mojo = mavenPluginManager.getConfiguredMojo(Mojo.class, session, cacheCandidate);
final CompletedExecution completedExecution = cachedBuild.findMojoExecutionInfo(cacheCandidate);
final String fullGoalName = cacheCandidate.getMojoDescriptor().getFullGoalName();
if (completedExecution != null && !isParamsMatched(project, cacheCandidate, mojo, completedExecution)) {
LOGGER.info(
"Mojo cached parameters mismatch with actual, forcing full project build. Mojo: {}",
fullGoalName);
consistent = false;
}
if (consistent) {
long elapsed = System.currentTimeMillis() - createdTimestamp;
LOGGER.debug(
"Plugin execution will be skipped ({} : reconciled in {} millis)", elapsed, fullGoalName);
}
LOGGER.debug(
"Checked {}, resolved mojo: {}, cached params: {}", fullGoalName, mojo, completedExecution);
} catch (PluginContainerException | PluginConfigurationException e) {
throw new LifecycleExecutionException("Cannot get configured mojo", e);
} finally {
if (mojo != null) {
mavenPluginManager.releaseMojo(mojo, cacheCandidate);
}
}
} else {
LOGGER.debug(
"Plugin execution will be skipped ({} : cached)",
cacheCandidate.getMojoDescriptor().getFullGoalName());
}
return consistent;
}