elharo commented on code in PR #690:
URL: https://github.com/apache/maven-war-plugin/pull/690#discussion_r4668318396


##########
src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java:
##########
@@ -329,9 +329,13 @@ protected boolean copyFile(
         context.addResource(targetFilename);
 
         BasicFileAttributes readAttributes = 
Files.readAttributes(source.toPath(), BasicFileAttributes.class);
+        // A directory source is archived into destination below, so 
destination's content can't be compared
+        // to it directly; fall back to the mtime-only check that was already 
used for directories.
         if (onlyIfModified
                 && destination.lastModified()
-                        >= readAttributes.lastModifiedTime().toMillis()) {
+                        >= readAttributes.lastModifiedTime().toMillis()
+                && (readAttributes.isDirectory()
+                        || 
org.apache.commons.io.FileUtils.contentEquals(source, destination))) {

Review Comment:
   1. Don't use the fully package qualified name
   2. Comparing the complete contents seems to imply we'll be doing just as 
much work here as the old way, maybe less writing but just as much or more 
reading



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to