You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2025/07/02 01:09:50 UTC

(maven) branch maven-4.0.x updated: Fix ReactorReader incorrect warnings and logic (fixes #2497, #2498) (#2536)

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/maven-4.0.x by this push:
     new 9a0418544a Fix ReactorReader incorrect warnings and logic (fixes #2497, #2498) (#2536)
9a0418544a is described below

commit 9a0418544ad586f06c9951f8d2c0f3aa7ffb42b5
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Jul 2 03:09:45 2025 +0200

    Fix ReactorReader incorrect warnings and logic (fixes #2497, #2498) (#2536)
    
    - Fix isPackagedArtifactUpToDate to return false when output files are newer
    - Skip up-to-date check for POM artifacts to avoid comparing class files against POM files
    - Resolves incorrect warnings when class files have same timestamp as POM files
    
    (cherry picked from commit e2d8c759461ade11c84db049497b70a8cd2c0640)
---
 .../main/java/org/apache/maven/ReactorReader.java  | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
index 825e38bcad..db2efa7720 100644
--- a/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
+++ b/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -113,10 +113,12 @@ public File findArtifact(Artifact artifact) {
         // No project, but most certainly a dependency which has been built previously
         File packagedArtifactFile = findInProjectLocalRepository(artifact);
         if (packagedArtifactFile != null && packagedArtifactFile.exists()) {
-            // Check if artifact is up-to-date
-            project = getProject(artifact, getAllProjects());
-            if (project != null) {
-                isPackagedArtifactUpToDate(project, packagedArtifactFile);
+            // Check if artifact is up-to-date (only for non-POM artifacts)
+            if (!"pom".equals(artifact.getExtension())) {
+                project = getProject(artifact, getAllProjects());
+                if (project != null) {
+                    isPackagedArtifactUpToDate(project, packagedArtifactFile);
+                }
             }
             return packagedArtifactFile;
         }
@@ -176,7 +178,9 @@ private File findArtifact(MavenProject project, Artifact artifact, boolean check
         File packagedArtifactFile = findInProjectLocalRepository(artifact);
         if (packagedArtifactFile != null
                 && packagedArtifactFile.exists()
-                && (!checkUptodate || isPackagedArtifactUpToDate(project, packagedArtifactFile))) {
+                && (!checkUptodate
+                        || "pom".equals(artifact.getExtension())
+                        || isPackagedArtifactUpToDate(project, packagedArtifactFile))) {
             return packagedArtifactFile;
         }
 
@@ -252,7 +256,14 @@ private boolean isPackagedArtifactUpToDate(MavenProject project, File packagedAr
                                     + "please run a full `mvn package` build",
                             relativizeOutputFile(outputFile),
                             project.getArtifactId());
-                    return true;
+                    return false;
+                } else if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug(
+                            "File '{}' timestamp {} vs artifact timestamp {} for '{}'",
+                            relativizeOutputFile(outputFile),
+                            outputFileLastModified,
+                            artifactLastModified,
+                            project.getArtifactId());
                 }
             }