in src/main/java/org/apache/maven/plugins/clean/Cleaner.java [182:207]
public void delete(@Nonnull Path basedir) throws IOException {
if (!Files.isDirectory(basedir)) {
if (Files.notExists(basedir)) {
if (logger.isDebugEnabled()) {
logger.debug("Skipping non-existing directory " + basedir);
}
return;
}
throw new IOException("Invalid base directory " + basedir);
}
if (logger.isInfoEnabled()) {
logger.info("Deleting " + basedir + (selector != null ? " (" + selector + ")" : ""));
}
var options = EnumSet.noneOf(FileVisitOption.class);
if (followSymlinks) {
options.add(FileVisitOption.FOLLOW_LINKS);
basedir = getCanonicalPath(basedir, null);
}
if (selector == null && !followSymlinks && fastDir != null && session != null) {
// If anything wrong happens, we'll just use the usual deletion mechanism
if (fastDelete(basedir)) {
return;
}
}
Files.walkFileTree(basedir, options, Integer.MAX_VALUE, this);
}