in src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java [289:340]
boolean isParamsMatched(
MavenProject project, MojoExecution mojoExecution, Mojo mojo, CompletedExecution completedExecution) {
List<TrackedProperty> tracked = cacheConfig.getTrackedProperties(mojoExecution);
for (TrackedProperty trackedProperty : tracked) {
final String propertyName = trackedProperty.getPropertyName();
String expectedValue = DtoUtils.findPropertyValue(propertyName, completedExecution);
if (expectedValue == null) {
expectedValue = trackedProperty.getDefaultValue() != null ? trackedProperty.getDefaultValue() : "null";
}
final String currentValue;
try {
Object value = ReflectionUtils.getValueIncludingSuperclasses(propertyName, mojo);
if (value instanceof File) {
Path baseDirPath = project.getBasedir().toPath();
Path path = ((File) value).toPath();
currentValue = normalizedPath(path, baseDirPath);
} else if (value instanceof Path) {
Path baseDirPath = project.getBasedir().toPath();
currentValue = normalizedPath(((Path) value), baseDirPath);
} else if (value != null && value.getClass().isArray()) {
currentValue = ArrayUtils.toString(value);
} else {
currentValue = String.valueOf(value);
}
} catch (IllegalAccessException e) {
LOGGER.error("Cannot extract plugin property {} from mojo {}", propertyName, mojo, e);
return false;
}
if (!StringUtils.equals(currentValue, expectedValue)) {
if (!StringUtils.equals(currentValue, trackedProperty.getSkipValue())) {
LOGGER.info(
"Plugin parameter mismatch found. Parameter: {}, expected: {}, actual: {}",
propertyName,
expectedValue,
currentValue);
return false;
} else {
LOGGER.warn(
"Cache contains plugin execution with skip flag and might be incomplete. "
+ "Property: {}, execution {}",
propertyName,
mojoExecutionKey(mojoExecution));
}
}
}
return true;
}