in src/main/java/org/apache/maven/plugins/clean/Cleaner.java [385:418]
private boolean tryDelete(final Path file) throws IOException {
try {
return Files.deleteIfExists(file);
} catch (IOException failure) {
if (retryOnError) {
if (ON_WINDOWS) {
// try to release any locks held by non-closed files
System.gc();
}
for (int delay : new int[] {50, 250, 750}) {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
failure.addSuppressed(e);
throw failure;
}
try {
return Files.deleteIfExists(file);
} catch (IOException again) {
again.addSuppressed(failure);
failure = again;
}
}
}
if (logger.isWarnEnabled()) {
logger.warn("Failed to delete " + file, failure);
}
failureCount++;
if (failOnError) {
throw failure;
}
return false;
}
}