jmh-gradle-plugin
jmh-gradle-plugin copied to clipboard
Gradle skips the jmh task when attempting to run the benchmarks again
Describe the bug When I attempt to run the jmh task a second time without making any code changes, Gradle skips running it. That's because Gradle sees that all the dependencies of the jmh task are unchanged so Gradle expects the output of the jmh task to be the same as the previous result and skips it.
To Reproduce
- Update some code that the benchmarks use.
- Run
./gradlew jmh
. This will run the benchmarks successfully. - Attempt to run
./gradlew jmh
again without making any changes - Bug: Gradle deems the jmh task as complete and skips it without attempting to run the benchmarks again
My Solution:
I'm not sure how to fix the gradle plugin but in case it helps, I fixed this problem on my end by adding the following to build.gradle.kts
:
// Consider the output of the JMH task always out of date to allow running benchmarks again even if no code changed
tasks.withType<me.champeau.jmh.JMHTask> {
outputs.upToDateWhen { false }
}