Gil*_*ili 1 java maven jmh java-module
我采用了一个使用maven-surefire-plugin(自动测试)来触发 JMH 基准测试的项目并将其添加module-info.java到其中。现在,META-INF/BenchmarkList不再生成(实际上,整个目录都丢失了)所以我在启动基准测试时最终出现以下错误:
ERROR: Unable to find the resource: /META-INF/BenchmarkList
我怀疑 Java 模块会阻止注释处理器正常运行,但我不知道如何修复它。有任何想法吗?
Gil*_*ili 10
我通过反复试验弄明白了。它看起来像是 maven-compiler-plugin 3.8.0 中的一个错误(或“功能”)。当module-info.java存在时,不再自动选取 JMH 注释处理器。添加此配置为我解决了问题:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
[...]
<annotationProcessorPaths>
<path>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
</path>
</annotationProcessorPaths>
[...]
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
更新:我提交了一个针对 maven-compiler-plugin的错误报告。
| 归档时间: |
|
| 查看次数: |
2674 次 |
| 最近记录: |