I’m trying to integrate JMH into a Java project that uses Gradle. JMH is an OpenJDK project that lets you run micro benchmarks on your Java code.
The tool works by first running an annotation processor from ‘jmh-core’ to generate synthetic code with the benchmarking instrumentation and a list of those benchmark files. You then package the generated code and all dependencies with the benchmark list in ‘META-INF/*’ and run the JAR.
I’d like to do this with a sourceSet called ‘perfTest’ in my current project. I’m not sure how to do this with Gradle, there’s a Maven plugin and an Ant build script.
I think it involves creating a separate ‘sourceSet’ and a ‘JavaCompile’ task and a ‘JavaExec’ task to run the sequence of events required by JMH but I’m not sure how.
Cheers,
Chris