You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gili (Jira)" <ji...@apache.org> on 2020/05/26 15:27:00 UTC

[jira] [Comment Edited] (MCOMPILER-369) Adding module-info.java breaks JMH annotation processor

    [ https://issues.apache.org/jira/browse/MCOMPILER-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756347#comment-16756347 ] 

Gili edited comment on MCOMPILER-369 at 5/26/20, 3:26 PM:
----------------------------------------------------------

I found a related discussion: [http://jigsaw-dev.1059479.n5.nabble.com/Annotation-processors-and-the-processor-module-path-tp5714320p5714342.html]

Alan Bateman writes:
{quote}When you deploy annotation processors on the --processor-module-path 
 then javac needs to resolve the annotation processor modules as part of 
 creating the dynamic configuration. The issue with the dependency on 
 java.xml.bind is that it's not in the boot layer and it's also not 
 observable on the processor module path. There is no support at this 
 time for augmenting the boot layer once it is created, also javac does 
 not attempt to resolve these modules from the original module path and 
 system image that were used to start the VM. So for now at least, 
 running with -J--add-modules=java.xml.bind is the only way to get this 
 to work. 
{quote}


was (Author: cowwoc):
I found an explanation: [http://jigsaw-dev.1059479.n5.nabble.com/Annotation-processors-and-the-processor-module-path-tp5714320p5714342.html]

Alan Bateman writes:
{quote}When you deploy annotation processors on the --processor-module-path 
 then javac needs to resolve the annotation processor modules as part of 
 creating the dynamic configuration. The issue with the dependency on 
 java.xml.bind is that it's not in the boot layer and it's also not 
 observable on the processor module path. There is no support at this 
 time for augmenting the boot layer once it is created, also javac does 
 not attempt to resolve these modules from the original module path and 
 system image that were used to start the VM. So for now at least, 
 running with -J--add-modules=java.xml.bind is the only way to get this 
 to work. 
{quote}
That said, I was unable to make it work under Java 11 because "java.xml.bind" has been removed.

> Adding module-info.java breaks JMH annotation processor
> -------------------------------------------------------
>
>                 Key: MCOMPILER-369
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-369
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.8.0
>            Reporter: Gili
>            Priority: Major
>         Attachments: annotation-processor-jigsaw.zip
>
>
> # Open testcase
>  # Run {{clean install}}. Notice that the benchmarks run.
>  # Open {{pom.xml}} and comment-out the {{<annotationProcessorPaths> section.}}
>  # Run {{clean install}}. Notice that the annotation processor does not run and the benchmarks break.
>  # Delete/rename {{module-info.java}}.
>  # Run {{clean install}}. Notice that the benchmarks work again.
> The documentation for {{<annotationProcessorPaths>}} states that by default annotation processors are detected from the classpath. It seems that adding {{module-info.java}} breaks that somehow, which is weird/unexpected because JMH exists as a dependency outside the newly-declared module.
> I did two things to prove that the annotation processor is not being invoked in step 4:
>  # Notice that {{target/test-classes/META-INF}} is not created.
>  # Place a breakpoint in {{org.openjdk.jmh.generators.BenchmarkProcessor}} and notice that it is never even constructed.
> I tried digging into the maven-compiler-plugin and plexus-compiler source-code but couldn't figure out where the problem is. The only workaround I found is to specify {{annotationProcessorPaths}} manually but it took me half a day to track down this problem.
> Any idea what is going on? Is this a bug in the plugin(s)?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)