Skip to content

doc: Clarify and enhance GraalVmProcessor configuration example #3786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/site/antora/modules/ROOT/pages/manual/plugins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ annotation processor creates such a file at compile-time.

[WARNING]
====
The `GraalVmProcessor` needs to know the `groupId` and `artifactId` coordinates of your project.
These must be supplied to the processor using the `log4j.graalvm.groupId` and `log4j.graalvm.artifactId` annotation processor options.
The `GraalVmProcessor` requires your project's `groupId` and `artifactId` to correctly generate the GraalVM reachability metadata file in the recommended location.
Provide these values to the processor using the `log4j.graalvm.groupId` and `log4j.graalvm.artifactId` annotation processor options.
====

You need to configure your build tool as follows to use both plugin processors:
Expand All @@ -227,15 +227,23 @@ Maven::
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<!-- Provide the project coordinates to `GraalVmProcessor`: -->
<arg>-Alog4j.graalvm.groupId=${project.groupId}</arg>
<arg>-Alog4j.graalvm.artifactId=${project.artifactId}</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<id>generate-log4j-plugin-descriptor</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-classes</phase>
<!--
~ Explicitly list the annotation processors for the default compile execution.
~ This is required starting with JDK 23, where annotation processors are not enabled automatically.
~ Explicit configuration also improves build reliability and clarity.
~ For more details, see: https://inside.java/2024/06/18/quality-heads-up/
-->
<id>default-compile</id>
<configuration>
<proc>only</proc>
<annotationProcessorPaths>
<!-- Include `log4j-core` providing
1. `org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor` that generates `Log4j2Plugins.dat`
Expand All @@ -252,11 +260,6 @@ Maven::
<!-- Process sources using `GraalVmProcessor` to generate a GraalVM reachability metadata file -->
<processor>org.apache.logging.log4j.core.config.plugins.processor.GraalVmProcessor</processor>
</annotationProcessors>
<compilerArgs>
<!-- Provide the project coordinates to `GraalVmProcessor`: -->
<arg>-Alog4j.graalvm.groupId=${project.groupId}</arg>
<arg>-Alog4j.graalvm.artifactId=${project.artifactId}</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down