jmh-gradle-plugin
jmh-gradle-plugin copied to clipboard
Unable to find the resource: /META-INF/BenchmarkList
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?
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 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.
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).
Perhaps related to #89 and #90
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'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.
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. 😸
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.