in src/main/java/org/apache/maven/shared/utils/io/FileUtils.java [1607:1623]
public static void rename(@Nonnull File from, @Nonnull File to) throws IOException {
if (to.exists() && !deleteLegacyStyle(to)) {
throw new IOException("Failed to delete " + to + " while trying to rename " + from);
}
File parent = to.getParentFile();
if (parent != null && !parent.exists() && !parent.mkdirs()) {
throw new IOException("Failed to create directory " + parent + " while trying to rename " + from);
}
if (!from.renameTo(to)) {
copyFile(from, to);
if (!deleteLegacyStyle(from)) {
throw new IOException("Failed to delete " + from + " while trying to rename it.");
}
}
}