Skip to content

Added support for passing annotation processor paths to the Java compiler#519

Open
sajeerzeji wants to merge 3 commits into
OpenLiberty:mainfrom
sajeerzeji:GHMAVEN2021-annotation_processor_paths_issue
Open

Added support for passing annotation processor paths to the Java compiler#519
sajeerzeji wants to merge 3 commits into
OpenLiberty:mainfrom
sajeerzeji:GHMAVEN2021-annotation_processor_paths_issue

Conversation

@sajeerzeji
Copy link
Copy Markdown

Fixes OpenLiberty/ci.maven#2021

Added support for passing annotation processor paths to the Java compiler via the -processorpath option. This enables annotation processors (Eg: Lombok) to run during compilation in dev mode.

addStringOption(options, "-target", target);
addStringOption(options, "--release", release);
addStringOption(options, "-encoding", encoding);
addStringOption(options, "-processorpath", annotationProcessorPath);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we also support the annotationProcessors parameter? When I look at ExecuteMojoUtil COMPILE_PARAMS, I see a very long list of possible parameters. Are there more in that list that should be passed along in the JavaCompilerOptions?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added annotation processor path and processors support to JavaCompilerOptions for dev mode hot reload compilation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about all the other parameters? I am not sure why we have them listed in COMPILE_PARAMS if we are not actually handling them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I checked this concern, the COMPILE_PARAMS is used to filter the maven-compiler-plugin configuration before executing the plugin. JavaCompilerOptions is used for hot reload and is populated by getMavenCompilerOptions() and passed to recompileJava().

Most COMPILE_PARAMS are not apply to JavaCompilerOptions, plugin specific parameters(compilerArgs, compilerArgument, etc) control the plugin not the compiler, common parameters(source, target, encoding) are already extracted, and build lifecycle parameters are not relevant for hot reload I think. Annotation processor parameters were the missing ones here, they need artifact resolution and are critical for hot reload, especially for libraries like Lombok.

…rOptions for dev mode hot reload compilation
@sajeerzeji sajeerzeji requested a review from cherylking June 1, 2026 11:51
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.

Annotation processors not run during hot reloads (Java 25)

2 participants