Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: Unable to find the resource: /META-INF/BenchmarkList when running JMH with gradle

Tags:

gradle

jmh

I want to benchmark my application using JMH. I am using JMH with gradle as build tool. The github repository is here.

But whenever I run the application com.demo.aerospike.JMHAerospikeSpringData I get below error.

$ gradle run

> Configure project :
Task :jmh Last added: null

> Task :run
JMHAerospikeSpringData is running ...
Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
    at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:98)
    at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:122)
    at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:256)
    at org.openjdk.jmh.runner.Runner.run(Runner.java:206)
    at com.demo.aerospike.JMHAerospikeSpringData.main(JMHAerospikeSpringData.java:47)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command 
'/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I tried different solutions in other stackoverflow but couldn't help.

Any idea what I'm missing.

like image 668
Rajkumar Natarajan Avatar asked Dec 08 '17 05:12

Rajkumar Natarajan


2 Answers

implementation 'org.openjdk.jmh:jmh-core:1.33'

annotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.33'

just like lombok

like image 108
ssehs Avatar answered Nov 09 '22 08:11

ssehs


I have resolved this problem by adding this dependency to my project:

testAnnotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$jmhVersion"

next to

testImplementation "org.openjdk.jmh:jmh-core:$jmhVersion"
like image 2
Adam Ostrožlík Avatar answered Nov 09 '22 08:11

Adam Ostrožlík