Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-525

Incremental recompile incorrect detection of dependency change

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.8.1, 3.9.0, 3.10.0, 3.10.1
    • 3.11.0
    • None

    Description

      I have just hit an issue running the ITs of maven-jar-plugin, specifically the MJAR-70-no-recreation test on Maven 3.9.0-SNAPSHOT.

      Trying to debug the issue I just found out that the issue is not related to Maven 3.9.0-SNAPSHOT but the real issue seems related to the maven-compiler-plugin used by default on that version.

      maven-compiler-plugins tries to detect changes on incremental compilation running isDependencyChanged() which in turn executes hasNewFile() but during the same run of maven, if the compile phase is run twice it would not detect correctly that nothing has changed since is just evaluating the file time of the class but the class ends up being newer than the buildStartTime, so this causes the recompilation.

      My proposal is to add a step to set the last modification time if the incremental compilation is enabled and that way it will use the exact same time than the buildStartTime() from maven.

      Attachments

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              jorsol Jorge Solórzano
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: