How to use JMH with gradle?

后端 未结 5 1808
清歌不尽
清歌不尽 2021-02-04 02:33

I want to use JMH, an OpenJDK microbenchmark tool, with gradle. However, Im getting the NPE on compilation. On the other hand, JMH works when using from maven.<

5条回答
  •  独厮守ぢ
    2021-02-04 02:51

    I made a very small example project to clone and modify as you like. It's a full working example:
    https://gitlab.com/barfuin/jmh-gradle-example

    It requires no shadow Jars and no plugins. The project also includes some extra Gradle tasks for printing the classpath, the JMH options, etc., stuff that may help to understand what's going on. It does not teach microbenchmarking though.

提交回复
热议问题