apache / apache/maven-compiler-plugin

[MCOMPILER-369] Adding module-info.java breaks JMH annotation processor

Open
#581 3 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[Gili](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=cowwoc)** opened **[MCOMPILER-369](https://issues.apache.org/jira/browse/MCOMPILER-369?redirect=false)** and commented

1. Open testcase
2. Run `clean install`. Notice that the benchmarks run.
3. Open `pom.xml` and comment-out the ` section.`
4. Run `clean install`. Notice that the annotation processor does not run and the benchmarks break.
5. Delete/rename `module-info.java`.
6. Run `clean install`. Notice that the benchmarks work again.

The documentation for `` 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:
1. Notice that `target/test-classes/META-INF` is not created.
2. 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)?

---

**Affects:** 3.8.0

**Attachments:**
- [annotation-processor-jigsaw.zip](https://issues.apache.org/jira/secure/attachment/12953047/annotation-processor-jigsaw.zip) (_2.02 kB_)

1 votes, 6 watchers

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.