GitHub user ppkarwasz added a comment to the discussion:
java.lang.IllegalArgumentException: The `GraalVmProcessor` annotation processor
is missing the required `log4j.graalvm.groupId` and `log4j.graalvm.artifactId`
options
Hi @jbisotti,
Thanks for the feedback regarding version `2.25.1` — much appreciated!
> We do not have any `@Plugin`s.
That’s mostly true — your **main code** doesn’t define any Log4j `@Plugin`s,
which is why the `GraalVmProcessor` isn’t triggered during the
`default-compile` phase. The warning about unrecognized annotation processor
options appears when either no annotation processor recognizes the specified
options, **or** the processor that does recognize them isn’t triggered because
it has no relevant annotations to process:
```shell
[INFO] --- maven-compiler-plugin:3.13.0:compile (default-compile) @ kfs-core ---
...
[WARNING] The following options were not recognized by any processor:
'[log4j.graalvm.artifactId, log4j.graalvm.groupId]'
```
However, the story is a bit different during **test compilation**. As you can
see this from the processor output, the `GraalVmProcessor` **is** triggered
during the `default-testCompile` phase:
```shell
[INFO] --- maven-compiler-plugin:3.13.0:testCompile (default-testCompile) @
kfs-core ---
...
[INFO] GraalVmProcessor: writing GraalVM metadata for 2 Java classes to
`META-INF/native-image/log4j-generated/cb86055/reflect-config.json`.
```
To eliminate the warnings about unrecognized options while keeping everything
working correctly, you can limit the annotation processor options to just the
`default-testCompile` phase like this:
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<compilerArgs>
<arg>-Werror</arg>
<arg>-Xlint:deprecation</arg>
</compilerArgs>
<showWarnings>true</showWarnings>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<configuration>
<compilerArgs combine.children="append">
<arg>-Alog4j.graalvm.groupId=${project.groupId}</arg>
<arg>-Alog4j.graalvm.artifactId=${project.artifactId}</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
```
GitHub link:
https://github.com/apache/logging-log4j2/discussions/3755#discussioncomment-13767755
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]