Skip to content

Fix ReactorReader incorrect warnings and logic (fixes #2497) #2498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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