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

Gradle skips the jmh task when attempting to run the benchmarks again

Open daniel-rusu opened this issue 5 months ago • 4 comments

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

  1. Update some code that the benchmarks use.
  2. Run ./gradlew jmh. This will run the benchmarks successfully.
  3. Attempt to run ./gradlew jmh again without making any changes
  4. 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 }
}

daniel-rusu avatar Sep 11 '24 06:09 daniel-rusu