How to add / META -INF / BenchmarkList to jmh task to fix "ERROR: cannot find resource: / META-INF / BenchmarkList"

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

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

+4
source share
1 answer

There were a couple of problems

  • JMHSample_02_BenchmarkModes class was incorrectly named java class
  • build.gradle missing apply plugin: "me.champeau.gradle.jmh"ad
  • In the jmhJarsection Main-Class, the manifest entry has been redefined (which is optional)

I did PR with corrections above. After applying it, you can run performance tests with

java -jar build/libs/JMH-Studies-jmh.jar
+1
source

Source: https://habr.com/ru/post/1650091/


All Articles