Unable to find the resource: /META-INF/BenchmarkList in Gradle project on Eclipse
The sample project is ready-to-run (builds in gradle and builds with Eclipse) @ https://github.com/langelescu/java-json-benchmark.
It is a forked Github repository setup to build in Gradle for which I created a Eclipse 2021-09 workspace. I am trying to run it 1) from the development environment Eclipse or 2) command line but encountering two errors:
- If I run it from Eclipse with Run configuration arguments "deser --apis stream --libs jackson,genson", I get:
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:263) at org.openjdk.jmh.runner.Runner.run(Runner.java:209) at com.github.fabienrenaud.jjb.Cli$AbstractCommand.run(Cli.java:110) at com.github.fabienrenaud.jjb.Cli.main(Cli.java:40)
- If I run it from the command line with command ./run deser --apis stream --libs jackson,genson, I get:
Exception in thread "main" io.airlift.airline.ParseArgumentsUnexpectedException: Found >unexpected parameters: [genson] at io.airlift.airline.Cli.validate(Cli.java:194) at io.airlift.airline.Cli.parse(Cli.java:132) at io.airlift.airline.Cli.parse(Cli.java:108) at io.airlift.airline.Cli.parse(Cli.java:103) at com.github.fabienrenaud.jjb.Cli.main(Cli.java:40)
Both usages are correct as per the readme in the original repository. I suspect it is a configuration problem that creates both issues. How do I fix it?
I think the problem about the first case is that you have annotation processing turned off when building with Eclipse. Previously I faced this issue on IDEA and the solution was to enable annotation processing. IDEA then picks up JMH's annotation processor declared as
annotationProcessor group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: "${jmhVersion}"
in your build.gradle
and generates the missing file.