简体   繁体   中英

How to append /META-INF/BenchmarkList to jmh task to fix “ERROR: Unable to find the resource: /META-INF/BenchmarkList”

I'm new to micro bench-marking in general. When I execute the JMH task in my project I get "ERROR: Unable to find the resource: /META-INF/BenchmarkList", I believe is created by jmh-generator-annprocess. I am using Gradle and I am trying to figure out if jmh-generator-annprocess is even working? Will it work properly for Gradle or do I need to use the Maven plugin or something?

https://github.com/coderrick/JMH-Studies.git in case you want to git clone my project and run it yourself.

There was a couple of issues

  1. JMHSample_02_BenchmarkModes class was in incorrectly named java class
  2. build.gradle was missing apply plugin: "me.champeau.gradle.jmh" declaration
  3. In jmhJar section Main-Class manifest entry was overridden (which is unnecessary)

I've made a PR with above fixes. After applying it you can run performance tests using

java -jar build/libs/JMH-Studies-jmh.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM