in src/main/java/org/apache/maven/plugin/compiler/IncrementalBuild.java [719:746]
String markNewOrModifiedSources() throws IOException {
for (SourceFile source : sourceFiles) {
if (!source.isNewOrModified) {
// Check even if `source.ignoreModification` is true.
Path output = source.getOutputFile();
if (Files.exists(output, LINK_OPTIONS)) {
FileTime t = Files.getLastModifiedTime(output, LINK_OPTIONS);
if (source.lastModified - t.toMillis() <= staleMillis) {
continue;
} else if (rebuildOnChange) {
return causeOfRebuild("at least one source file changed", false)
.toString();
}
} else if (rebuildOnAdd) {
StringBuilder causeOfRebuild = causeOfRebuild("of added source files", showCompilationChanges);
if (showCompilationChanges) {
causeOfRebuild
.append(System.lineSeparator())
.append(" + ")
.append(source.file);
}
return causeOfRebuild.toString();
}
source.isNewOrModified = true;
}
}
return null;
}