in src/main/java/org/apache/maven/shared/utils/io/FileUtils.java [737:763]
public static void copyFile(@Nonnull final File source, @Nonnull final File destination) throws IOException {
// check source exists
if (!source.exists()) {
final String message = "File " + source + " does not exist";
throw new IOException(message);
}
if (Files.isSymbolicLink(source.toPath())) {
File target = Files.readSymbolicLink(source.toPath()).toFile();
createSymbolicLink(destination, target);
return;
}
// check source != destination, see PLXUTILS-10
if (destination.exists() && Files.isSameFile(source.toPath(), destination.toPath())) {
// if they are equal, we can exit the method without doing any work
return;
}
mkdirsFor(destination);
doCopyFile(source, destination);
if (source.length() != destination.length()) {
final String message = "Failed to copy full contents from " + source + " to " + destination;
throw new IOException(message);
}
}