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


##########
src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java:
##########
@@ -329,9 +329,12 @@ protected boolean copyFile(
         context.addResource(targetFilename);
 
         BasicFileAttributes readAttributes = 
Files.readAttributes(source.toPath(), BasicFileAttributes.class);
+        // A directory source is archived into destination below, so its own 
filesystem size has no
+        // relation to the resulting jar's size; only compare sizes for a 
plain file source.
         if (onlyIfModified
                 && destination.lastModified()
-                        >= readAttributes.lastModifiedTime().toMillis()) {
+                        >= readAttributes.lastModifiedTime().toMillis()
+                && (readAttributes.isDirectory() || destination.length() == 
readAttributes.size())) {

Review Comment:
   This still skips a regular file when its content changes in place without 
changing length: with the same coarse mtime and equal source/destination sizes, 
this condition remains true and leaves the destination stale. File size is only 
a heuristic for the issue described; please also validate equal-sized content 
(or otherwise invalidate this case) and cover that scenario with a test.



-- 
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