[ https://issues.apache.org/jira/browse/MCOMPILER-515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839855#comment-17839855 ]
ASF GitHub Bot commented on MCOMPILER-515: ------------------------------------------ hunterpayne commented on PR #160: URL: https://github.com/apache/maven-compiler-plugin/pull/160#issuecomment-2070978534 I can tell you with 100% certainty that only tracking file timestamps won't work and will be a bug farm. You must know which .class files are generated from which .java files and in addition know which .class files depend upon which other .class files. If this isn't possible, then it isn't possible to implement this feature in a maintainable way. So either we need to track this additional information, or relax the requirement to so, module level or package level and track dependencies at that level. I am OK with either path but we shouldn't go ahead with only tracking file timestamps and acting like that is a working incremental build feature. On Monday, April 22, 2024 at 02:17:06 PM PDT, Martin Desruisseaux ***@***.***> wrote: While incremental builds is important, my reading of the source code inherited from Maven 3 suggests that in its current state, incremental build has bugs causing the opposite effect than what the plugin wanted to achieve. We could try to fix the Maven 3 compiler plugin, but I do not know if it is worth the effort given that the plugin is getting a significant rewrite for Maven 4. The current useIncrementalCompilation parameter is a boolean flag which is actually mixing at least two aspects: whether to check if a dependency changed, and how to detect which source files changed. I suggest to deprecate that parameter and replace it with a new incrementalCompilation parameter (same name but without use prefix). The value of that parameter would be a comma-separated list of the following: - dependencies: check whether a dependency changed. - sources: check whether a source file has been updated, or whether source files were added or removed. - classes: check whether a source file is more recent than its .class file. - modules (new): don't try to do incremental build in Maven, but delegate that task to javac instead. This is possible only with modular projects. It uses the --module compiler option, which is an alternative to enumerating all source files on the command-line. Equivalences with the current parameter: - useIncrementalCompilation = true is equivalent to incrementalCompilation = dependencies,sources (except maybe for the cases of newly added source files). - useIncrementalCompilation = false is equivalent to incrementalCompilation = classes. For an initial version of the Maven 4 compiler plugin, detection of changes would be based only on file timestamps. This is the same strategy than the current plugin. This approach would be unable to detect that a class needs to be recompiled because it depends on another class which has been changed. However, the current plugin cannot detect such cases neither, so we don't lost anything. If we support that feature in the future, it would be one new value in the above-cited list of comma-separated values. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: ***@***.***> > Plugin is NOT incremental, so let it go > --------------------------------------- > > Key: MCOMPILER-515 > URL: https://issues.apache.org/jira/browse/MCOMPILER-515 > Project: Maven Compiler Plugin > Issue Type: Bug > Reporter: Tamas Cservenak > Priority: Major > > The maven-compiler-plugin is NOT incremental, so we should just let it go. > The shared incremental stuff is broken since it's last factual code change > (2012!). > Moreover, the broken incremental stuff just makes us look bad, see the "mvn > clean install" vs "mvn verify" issue: > [https://www.youtube.com/watch?v=XeQj-IbSxJI] > Accept it, that this plugins is not incremental, so it should not make users > believe it is. Moreover, the bugs in this feature exist for too long, that > just cause harm to users and to project as whole. -- This message was sent by Atlassian Jira (v8.20.10#820010)