Repository navigation
Conversation
When `proc` is unset, `javac` enables annotation processing by default before Java 23 (`-proc:full`) and discovers processors on the compile classpath. The plugin therefore conservatively assumes a processor may be present and applies `rebuild-on-add,rebuild-on-change` by default, doing a full rebuild on any change even when no processor is actually present. This behaviour is intentional (a partial recompile can lose processor-generated state); document it in the incrementalCompilation default-value javadoc, and note that Java < 23 users with no annotation processor can restore per-file recompilation by setting `proc` to `none` or an explicit `incrementalCompilation`.
…JDKs `incremental-proc-none-per-file` compiles three independent classes with `proc=none`, modifies one between two `compile` invocations, and asserts that only the modified file is recompiled. This exercises the documented workaround for Java < 23 and is green on all JDKs (verified on 21 and 25).
There was a problem hiding this comment.
Pull request overview
This PR updates the plugin documentation to explicitly describe why incremental compilation defaults to a conservative full rebuild on JDK < 23 when proc is unset, and adds a new invoker integration test that validates the documented workaround (proc=none) produces per-file recompilation.
Changes:
- Clarify
AbstractCompilerMojo#incrementalCompilation“Default value” Javadoc to explain the JDK < 23 conservative behavior whenprocis unset, and how to restore per-file recompilation. - Add a new invoker IT (
incremental-proc-none-per-file) that disables annotation processing (proc=none), modifies one of three independent classes between twocompileruns, and asserts only the modified file is recompiled.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java | Documents the intentional conservative incremental default on JDK < 23 when proc is unset, and points to proc=none / explicit incremental config as the workaround. |
| src/it/incremental-proc-none-per-file/pom.xml | Defines an invoker IT project with proc=none and a Groovy step to modify a source file between builds. |
| src/it/incremental-proc-none-per-file/invoker.properties | Runs clean compile, modifies one source file, then runs compile again to exercise incremental recompilation. |
| src/it/incremental-proc-none-per-file/verify.groovy | Asserts the incremental log indicates exactly one modified file is compiled and no “recompile all” fallback occurs. |
| src/it/incremental-proc-none-per-file/src/main/java/it/A.java | Test input class A. |
| src/it/incremental-proc-none-per-file/src/main/java/it/B.java | Test input class B. |
| src/it/incremental-proc-none-per-file/src/main/java/it/C.java | Test input class C. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
desruisseaux
approved these changes
Jul 20, 2026
…spaces Reflow the incrementalCompilation default-value paragraph so each line breaks at a sentence or comma-delimited clause boundary (cleaner future diffs), and replace the non-breaking spaces with regular spaces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1085.
Per @desruisseaux's steer on the issue: the full rebuild on any change (when
procis unset on JDK < 23) is intentional. Before Java 23javacdefaults to-proc:fulland discovers annotation processors on the compile classpath, and recompiling everything avoids losing processor-generated state (e.g. missedMETA-INF/servicesregistrations). So this keeps the behaviour and documents it instead of changing it.Changes
AbstractCompilerMojo: clarify theincrementalCompilationdefault-value javadoc — why, on JDK < 23 withprocunset, the plugin conservatively assumes a processor may be present, and that settingproctonone(or an explicitincrementalCompilation) restores per-file recompilation.incremental-proc-none-per-file: withproc=none, changing one of three independent classes recompiles only that file. This exercises the documented workaround and is green on all JDKs (verified on 21 and 25).Doc + test only; no behavioural change.