【问题标题】:How to append /META-INF/BenchmarkList to jmh task to fix "ERROR: Unable to find the resource: /META-INF/BenchmarkList"如何将 /META-INF/BenchmarkList 附加到 jmh 任务以修复“错误:无法找到资源:/META-INF/BenchmarkList”
【发布时间】:2016-08-03 22:26:30
【问题描述】:
总的来说,我是微基准测试的新手。当我在我的项目中执行 JMH 任务时,我得到“错误:无法找到资源:/META-INF/BenchmarkList”,我相信是由 jmh-generator-annprocess 创建的。我正在使用 Gradle 并试图弄清楚 jmh-generator-annprocess 是否正常工作? Gradle 是否可以正常工作,还是我需要使用 Maven 插件或其他东西?
https://github.com/coderrick/JMH-Studies.git 如果你想git clone 我的项目并自己运行它。
【问题讨论】:
标签:
java
performance
gradle
build.gradle
jmh
【解决方案1】:
有几个问题
-
JMHSample_02_BenchmarkModes 类在错误命名的 java 类中
- build.gradle 缺少
apply plugin: "me.champeau.gradle.jmh" 声明
- 在
jmhJar 部分Main-Class 清单条目被覆盖(这是不必要的)
我已经通过上述修复创建了PR。应用它后,您可以使用
运行性能测试
java -jar build/libs/JMH-Studies-jmh.jar