desruisseaux commented on PR #160:
URL: 
https://github.com/apache/maven-compiler-plugin/pull/160#issuecomment-2070967076

   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to