You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jorge Solórzano (Jira)" <ji...@apache.org> on 2023/01/28 21:06:00 UTC

[jira] [Created] (MCOMPILER-525) Incremental recompile incorrect detection of dependency change

Jorge Solórzano created MCOMPILER-525:
-----------------------------------------

             Summary: Incremental recompile incorrect detection of dependency change
                 Key: MCOMPILER-525
                 URL: https://issues.apache.org/jira/browse/MCOMPILER-525
             Project: Maven Compiler Plugin
          Issue Type: Bug
    Affects Versions: 3.10.1
            Reporter: Jorge Solórzano


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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)