{"action":"closed","issue":{"url":"https://api.github.com/repos/ktoso/sbt-jmh/issues/29","labels_url":"https://api.github.com/repos/ktoso/sbt-jmh/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/ktoso/sbt-jmh/issues/29/comments","events_url":"https://api.github.com/repos/ktoso/sbt-jmh/issues/29/events","html_url":"https://github.com/ktoso/sbt-jmh/issues/29","id":55683978,"number":29,"title":"Enable programmatic running of benchmarks","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ktoso/sbt-jmh/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-27T22:27:35Z","updated_at":"2015-01-27T23:20:19Z","closed_at":"2015-01-27T23:20:19Z","body":"As discussed in https://github.com/ktoso/sbt-jmh/issues/27#issuecomment-71740709 we sometimes may want to `runMain com.example.MyRunner` in order to get programatic access to the test results (send them over somewhere etc). \r\n\r\nThis does not currently work, and we'll get \r\n\r\n```\r\n[info] # JMH 1.5 (released 5 days ago)\r\n[info] # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/bin/java\r\n[info] # VM options: <none>\r\n[info] # Warmup: 1 iterations, single-shot each\r\n[info] # Measurement: 1 iterations, single-shot each\r\n[info] # Timeout: 10 min per iteration\r\n[info] # Threads: 1 thread\r\n[info] # Benchmark mode: Single shot invocation time\r\n[info] # Benchmark: org.openjdk.jmh.samples.JMHSample_02_BenchmarkModes.measureSingleShot\r\n[info]\r\n[info] # Run progress: 100.00% complete, ETA 00:00:00\r\n[info] # Fork: 1 of 1\r\n[info] <failure>\r\n[info]\r\n[info] java.lang.IllegalArgumentException: Benchmark does not match a class\r\n[info] \tat org.openjdk.jmh.util.ClassUtils.loadClass(ClassUtils.java:90)\r\n[info] \tat org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:214)\r\n[info] \tat org.openjdk.jmh.runner.BaseRunner.runBenchmarks(BaseRunner.java:111)\r\n[info] \tat org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:51)\r\n[info] \tat org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:80)\r\n[info] Caused by: java.lang.ClassNotFoundException: org.openjdk.jmh.samples.generated.JMHSample_02_BenchmarkModes_measureSingleShot\r\n[info] \tat java.net.URLClassLoader$1.run(URLClassLoader.java:366)\r\n[info] \tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n[info] \tat java.security.AccessController.doPrivileged(Native Method)\r\n[info] \tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n[info] \tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)\r\n[info] \tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n[info] \tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)\r\n[info] \tat java.lang.Class.forName0(Native Method)\r\n[info] \tat java.lang.Class.forName(Class.java:191)\r\n[info] \tat org.openjdk.jmh.util.ClassUtils.loadClass(ClassUtils.java:72)\r\n[info] \t... 4 more\r\n[info]\r\n[info]\r\n```\r\n\r\nAdding these: \r\n\r\n```\r\n./target/scala-2.10/classes/...\r\n```\r\n\r\nto the classpath should solve things."}}