Closed jdpgrailsdev closed 6 years ago
Update: If I run the jmhJar
task explicitly, after it completes the BenchmarkList
file included in the JAR file is blank. However, the file on disk in build/jmh-generated-resources/META-INF
has the includes in it. I am not using the shadow JAR support and from the looks of the code, the contents of the generated resources should be in the JAR: https://github.com/melix/jmh-gradle-plugin/blob/master/src/main/groovy/me/champeau/gradle/JMHPlugin.groovy#L229.
I see what the issue is. The BenchmarkList
and CompilerHints
file show up in both the jmh-generated-classes
and jmh-generated-resources
directories. Because of this (and the order in which they are added to the JAR), the one in the jmh-generated-classes
directory always wins. I will put a PR in to reverse the order to fix this issue.
Closed by the PR above, thanks!
Hey @melix I seem to still be having this issue with version 0.5.0
of the plugin.
META-INF/BenchmarkList in my project-name-jmh.jar is empty.
This is my gradle build:
plugins {
java
application
id("me.champeau.gradle.jmh") version("0.5.0")
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
jmh("commons-io:commons-io:2.4")
jmh("org.openjdk.jmh:jmh-core:1.21")
jmh("org.openjdk.jmh:jmh-generator-annprocess:0.9")
implementation("org.openjdk.jmh:jmh-core:1.21")
implementation("org.openjdk.jmh:jmh-generator-annprocess:0.9")
}
application {
mainClassName = "com.bitemyapp.Main"
}
val fatJar = task("fatJar", type = Jar::class) {
archiveBaseName.set("${project.name}-fat")
manifest {
attributes["Implementation-Title"] = "Benchmark test"
attributes["Implementation-Version"] = "0.0.1"
attributes["Main-Class"] = "com.bitemyapp.Main"
}
from(configurations.runtimeClasspath.get().map({ if (it.isDirectory) it else zipTree(it) }))
with(tasks.jar.get() as CopySpec)
}
tasks {
"build" {
dependsOn(fatJar)
}
}
Am I missing something? I tried to follow the README carefully.
To explicit, the error I'm getting is Caused by: No benchmarks to run; check the include/exclude regexps.
$ java -jar ./build/libs/java-workbench-jmh.jar -l
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils (file:/home/callen/work/java-workbench/build/libs/java-workbench-jmh.jar) to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.openjdk.jmh.util.Utils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Benchmarks:
Also shows no benchmarks were picked up.
I have a project using version 0.4.6 of the Gradle plugin with Gradle 4.8 and no matter what I do, I receive the following error when executing the
jmh
task:After doing some searching around, I noticed a few people mentioning that the
build/jmh-generated-resources/META-INF/BenchmarkList
file is getting wiped out. I can confirm that this is indeed happening. If I run thejmhCompileGeneratedClasses
andjmhRunBytecodeGenerator
tasks manually, I can confirm the version of theBenchmarkList
file that gets generated in thebuild
directory has my benchmarks in it. However, if I run thejmh
task, it fails and if I inspect the file, it is empty. I have also tried the 0.4.5 (which is apparently the minimum for Gradle 4.8) without any luck either.