JMH - run without Maven
Asked Answered
A

1

10

I am trying to setup the very basic JMH test suite but I cannot get through to generate the jar with the tests... I have annotation processor on the classpath, with jmh core too, one simple class but when I run Main.main() there are no jars being generated (running it from IntelliJ). Is there some parameter/option I am missing when running?

Anamorphosis answered 24/6, 2014 at 14:19 Comment(6)
I think you need to use maven because jmh uses the shade plugin which auto-generates some code based on your benchmarks (i.e. JMH does not run your benchmarks as you write them but a modified version that deals with various JIT optimisations). I may be wrong.Hydroxide
JAR generation is not required to run JHM benchmarks. Just make sure that annotation processing is enabled in Settings/Compiler/Annotation Processors and JHM processor is endeed on the compilation classpath. The correct code will be generated during normal compilation process.Moldau
@OlegEstekhin - Awersome, that is precisely what I was lacking. All other bits were there.Anamorphosis
You might find this useful rationaljava.com/2015/02/…Fluoroscope
If you only have jmh-coreon your classpath you further need jmh-generator-annprocessdependencyMalemute
Thanks, worked for me similarly in Eclipse.Babbler
J
0

I think you cannot not generate benchmarks.jar without maven-shade-plugin.

If you still want to run from the command line but without benchmarks.jar you can copy the command IDEA executes from the console and run it from terminal.

Jellybean answered 24/1, 2022 at 12:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.