gnodet opened a new pull request, #1143: URL: https://github.com/apache/maven-compiler-plugin/pull/1143
## Problem The current default incremental compilation configuration for Java >= 23 / no annotation processor projects is `options,dependencies,sources`. This allows partial builds — only modified source files are passed to javac. While faster, this is unsafe: if `Foo.java` changes a method signature, `Bar.java` (which calls `Foo`) is not recompiled, potentially leaving a stale `Bar.class` that causes `NoSuchMethodError` at runtime. This is the same correctness risk that made `useIncrementalCompilation=false` "not recommended" in 3.x. Notably, the annotation-processor path already defaults to `rebuild-on-change` — so the behavior was inconsistent: safe with processors, potentially unsafe without. ## Change Add `rebuild-on-change` to the base default, making it `options,dependencies,sources,rebuild-on-change` for all projects regardless of annotation processor presence. Users who want faster (but potentially unsafe) per-file recompilation can still opt in explicitly with: ```xml <incrementalCompilation>options,dependencies,sources</incrementalCompilation> ``` ## Relationship to PR #1123 This was identified during the review discussion on #1123, where the Javadoc for `incrementalCompilation` was being clarified. The Javadoc explicitly documents the limitation: *"the current compiler-plugin does not detect structural changes other than file addition or removal"*. Making the default safe is the natural complement to that documentation. Fixes MCOMPILER-563 (partial — correctness concern). -- 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]
