jmh-gradle-plugin icon indicating copy to clipboard operation
jmh-gradle-plugin copied to clipboard

Unable to find the resource: /META-INF/BenchmarkList

Open fabienrenaud opened this issue 8 years ago • 8 comments

I am trying to run JMH against LoganSquare, which depends on the gradle apt plugin and also does annotation processing. But every time I do and start the program using my entry point and the uberjar, i get the following exception message:

Unable to find the resource: /META-INF/BenchmarkList

My guess is the annotation processor or logansquare passes after the JMH plugin and wipes the file out. Is there anything I can do?

fabienrenaud avatar Jul 01 '16 22:07 fabienrenaud

Not sure what project is to blame in this... but i fixed my problem by switching the 'jmh-generator-annprocess' dependency from compile to apt and moving it to the very end of the list of dependencies (after all the other apts) in my build.gradle.

Before:

dependencies {
    compile group: 'org.openjdk.jmh', name: 'jmh-core', version: '1.12'
    apt group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.12'

    compile: 'depA'
    compile: 'depB'
    compile: 'depC'
    apt 'apt1'
    apt 'apt2'

    // Test
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

and BenchmarkList is missing after building...

After:

dependencies {
    compile: 'depA'
    compile: 'depB'
    compile: 'depC'
    apt 'apt1'
    apt 'apt2'

    testCompile group: 'junit', name: 'junit', version: '4.12'

    compile group: 'org.openjdk.jmh', name: 'jmh-core', version: '1.12'
    apt group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.12'
}

And now I can run all my benchmarks with the annotations of the other projects processed too (after running a gradle clean build).

fabienrenaud avatar Jul 25 '16 01:07 fabienrenaud

@fabienrenaud which version of plugin you are using? Since version 0.3.0 this plugin is not using annotation processor. Instead it relies on code generation, i.e. uses jmh-generator-bytecode dependency.

vyazelenko avatar Aug 19 '16 09:08 vyazelenko

I was using v0.3.0 when i opened this issue. it could be the other annotation processors were wiping out the generated byte code of jmh and only jmh (they weren't wiping out code generated by other annotation processors).

fabienrenaud avatar Aug 19 '16 22:08 fabienrenaud

Perhaps related to #89 and #90

vyazelenko avatar Mar 23 '17 16:03 vyazelenko

I have pretty much the same problem using version 0.4.8 of this plugin:

> A failure occurred while executing me.champeau.gradle.IsolatedRunner
   > ERROR: Unable to find the resource: /META-INF/BenchmarkList

Oddly, the /META-INF/BenchmarkList file is generated - I see it in {buildDir}/jmh-generated-resources. It is also added properly to the produced jmh jar.

But running the benchmark fails still with this error.

Help?

sebersole avatar Oct 10 '19 12:10 sebersole

I'm sorry I don't have bandwidth to look into this now. At this point I suspect a resource loading issue in JMH itself, maybe because of the context class loader usage, but I have no clue at this point.

melix avatar Oct 10 '19 15:10 melix

I encountered this problem, though I'm benchmarking directly w/o jmh-gradle-plugin...

I add testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.22' to my build.gradle, and the error gone. it works now. 😸

Ray-Eldath avatar Jan 21 '20 14:01 Ray-Eldath

I have pretty much the same problem using version 0.4.8 of this plugin:

> A failure occurred while executing me.champeau.gradle.IsolatedRunner
   > ERROR: Unable to find the resource: /META-INF/BenchmarkList

Oddly, the /META-INF/BenchmarkList file is generated - I see it in {buildDir}/jmh-generated-resources. It is also added properly to the produced jmh jar.

But running the benchmark fails still with this error.

Help?

I encountered the same issue. I updated the plugin version to the latest (5.0; need to use gradle 5.0+ as well) and found the issue seems gone.

NathanQingyangXu avatar May 10 '20 21:05 NathanQingyangXu