Skip to content

Conversation

@Manas-Dikshit
Copy link

Summary

This PR fixes issue #1006, where the Maven Compiler Plugin did not execute annotation processors properly when <proc>only</proc> was set. Previously, the plugin exited early with the message "Nothing to compile - all classes are up to date," which stopped annotation processors from running.

Changes

  • Updated the execute() method to make sure that when <proc>only</proc> is set, the compiler runs even if no Java source files have changed.
  • Added a clear log message to show that annotation processing is taking place without regular compilation.

Rationale

Annotation processors like Log4j’s PluginProcessor must run independently of source compilation. This change makes the plugin behave like javac -proc:only and clears up confusion from misleading log messages.

Impact

  • No change in behavior for standard compilation.
  • Improves correctness and clarity when using <proc>only</proc>.
  • Backward compatible and safe for existing builds.

Verification

  • Verified locally with a project using Log4j’s annotation processor.
  • Confirmed the generated sources appear as expected in target/generated-sources/annotations.
  • All existing integration tests pass with mvn -Prun-its verify.

Please review and let me know if you want me to add an integration test for this specific use case.

@slachiewicz
Copy link
Member

please fix formatting

@Manas-Dikshit
Copy link
Author

fixed.

* Base class of Mojos compiling Java source code.
* This plugin uses the {@link JavaCompiler} interface from JDK 6+.
* Each instance shall be used only once, then discarded.
* Base class of Mojos compiling Java source code. This plugin uses the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert this unnecesary changes to javadocs here and bellow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add that the previous formatting was intentional. We try to change lines after a natural separator such as a dot, or a comma if the line is too long. This is because in commits, changes are shown on a line-by-line basis. When sentences are on their own line, then if (for example) the sentence "Base class of Mojos…" is changed, it is easier to see that the "This plugin uses…" sentence is not modified.

@slachiewicz slachiewicz marked this pull request as draft January 26, 2026 22:07
@slachiewicz
Copy link
Member

avoid changing javadocs comments if not needed.
To apply formatting run
mvn spotless:apply

@slachiewicz
Copy link
Member

slachiewicz commented Jan 26, 2026

Also add test that will show problem described in #1006
Please carefully check to what branch You propose changes as master branch is for 4.x plugin

@Manas-Dikshit
Copy link
Author

I have restored the previous code and only changed what i want to, means where the Maven Compiler Plugin did not execute annotation processors properly when only was set. The main thing is i actually formatted the code in the code editor not used the formatting command. making sure that it is now ready for review.

@Manas-Dikshit Manas-Dikshit marked this pull request as ready for review January 27, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants