Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Jun 19, 2025

Summary

Fixes #2497 by correcting the ReactorReader logic that was causing incorrect warnings and behavior.

Problem

The ReactorReader was:

  1. Comparing class files against POM files instead of JAR files
  2. Returning true (up-to-date) when output files were newer than packaged artifacts
  3. Showing misleading warnings even when timestamps were equal

Root Cause

The debug output revealed that the comparison was happening against POM files:

  • outputFileLastModified = 1750337881113 (Name.class)
  • artifactLastModified = 1750335603495 (domain-3.1.4-SNAPSHOT.pom)

This is fundamentally wrong because class files should be compared against JAR files, not POM files.

Solution

  1. Fixed return value: Changed return true to return false when output files are newer than packaged artifacts
  2. Skip POM artifacts: Added checks to skip up-to-date validation for POM artifacts since comparing class files against POM files doesn't make sense

Changes

  • impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java:
    • Line 255: Fixed return value from true to false when files are newer
    • Lines 115-119: Skip up-to-date check for POM artifacts
    • Lines 180: Skip up-to-date check for POM artifacts in findArtifact method

Expected Behavior

  • No more incorrect warnings when comparing class files against POM files
  • Correct behavior for JAR artifacts with proper fallback to output directory
  • Proper reactor behavior using most up-to-date artifacts during multi-module builds

Testing

Tested with the reproducer case where class files and POM files had the same timestamp - the incorrect warning no longer appears.


Pull Request opened by Augment Code with guidance from the PR author

- 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
@gnodet gnodet added this to the 4.0.0 milestone Jun 19, 2025
@gnodet gnodet changed the title [MNG-2497] Fix ReactorReader incorrect warnings and logic Fix ReactorReader incorrect warnings and logic (fixes #2497) Jun 19, 2025
@khmarbaise khmarbaise self-requested a review June 30, 2025 15:06
@gnodet gnodet modified the milestones: 4.0.0, 4.1.0 Jul 1, 2025
@gnodet gnodet merged commit e2d8c75 into apache:master Jul 1, 2025
19 checks passed
gnodet added a commit to gnodet/maven that referenced this pull request Jul 1, 2025
…ache#2498)

- 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 e2d8c75)
@gnodet
Copy link
Contributor Author

gnodet commented Jul 1, 2025

💚 All backports created successfully

Status Branch Result
maven-4.0.x

Questions ?

Please refer to the Backport tool documentation

gnodet added a commit to gnodet/maven that referenced this pull request Jul 1, 2025
…ache#2498)

- 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 e2d8c75)
gnodet added a commit that referenced this pull request Jul 2, 2025
…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 e2d8c75)
@gnodet gnodet added the bug Something isn't working label Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WARNING - X is more recent than the packaged artifact for Y

3 participants