1

I'm trying to run JMH benchmarks from inside Eclipse. It's a Maven (m2e) project, the pom.xml includes the correct dependencies (jmh-core and jmh-generator-annprocess, v1.9.3), the project compiles in Eclipse and the benchmarks can be run on the commandline via mvn clean install and java -jar target/benchmarks.jar. However, when I try to run one of the samples from Eclipse (Run As > Java Application), I get the following error:

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:96)
    at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:104)
    at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:251)
    at org.openjdk.jmh.runner.Runner.run(Runner.java:203)
    at example.JMHSample_01_HelloWorld.main(JMHSample_01_HelloWorld.java:100)

Annotation processing is enabled in the project properties. The file /META-INF/BenchmarkList is created by a maven build, but not by an Eclipse build. Why?

Update:

There is another question about JMH and Eclipse but it's about a very old JMH version and a different error message. I'd like to understand the reason for this problem, i.e. is the annotation not being processed or is the generated code not found etc.

Community
  • 1
  • 1
ralfstx
  • 3,893
  • 2
  • 25
  • 41

0 Answers0