Description
FileUtils.copyFile was changed to use the NIO Files.copy call a while back. Files.copy is invoked with the COPY_ATTRIBUTES and REPLACE_EXISTING attributes (which makes sense).
However, on Windows, COPY_ATTRIBUTES preserves the read-only flag if it's set on the source file, BUT REPLACE_EXISTING fails with an AccessDeniedException exception if the destinations' read-only attribute is set.
This is problematic because it breaks existing builds when updating from maven-war-plugin:3.1.0 to maven-war-plugin-3.2.0 (which switch from plexus-utils-3.0.24 to plexus-utils-3.1.0) where the SCM uses the read-only flag for unmodified files, e.g. Perforce.
TBH, I'm not sure where I come down on whether this is a bug in the JDK (REPLACE_EXISTING doesn't) or plexus-utils (using COPY_ATTRIBUTES may include attributes that make subsequent invocations with REPLACE_EXISTING to fail in a platform-specific way).