"No matching benchmarks" when running JMH from main in eclipse

Kranach picture Kranach · Jan 28, 2014 · Viewed 7.9k times · Source

I wanted to try out the new feature of JMH by running it as Java Application in eclipse. I imported and built jmh-samples project. Compiled classes ended in /jmh-samples/target/generated-sources/annotations, there are several JARs in /target/ and running microbenchmarks.jar from command line works as usual.

However when I execute main I always get

No matching benchmarks. Miss-spelled regexp?

Any ideas? I am using version 0.3

Answer

Aleksey Shipilev picture Aleksey Shipilev · Jan 29, 2014

jmh-dev@ is a better way to communicate this with the developers.

Few things to try:

  1. Hijacking Main is probably not a good idea. Use Java API instead, like this sample.
  2. Use -v extra to debug the pattern matching: either the filter regexp is incorrect, or there are no benchmarks to run.
  3. If the regexp is incorrect, fix it.
  4. If there are no benchmarks to match against, then there is a chance resources are not generated and/or picked up properly. Make sure target/classes/ is also available on classpath.