Search code examples
mavenintellij-ideajmh

How to import jmh in IDEA(JDK15)


how to config the jmh in IDEA

the tutorial I followed: https://www.baeldung.com/java-microbenchmark-harness

I use the JDK 15 ,after I import relative dependency enter image description here

still got a error

enter image description here But I heard that after jdk12, jmh has been integrated into jdk. How to fix this ,or recommend me another tutorial,thanks...


Solution

  • You pasted the dependencies into the wrong section. You need to crate dependencies tag and paste the dependencies there:

    <dependencies>
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-core</artifactId>
      <version>1.28</version>
    </dependency>
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-generator-annprocess</artifactId>
      <version>1.28</version>
    </dependency>
    </dependencies>
    

    Then Reload the project in Maven tool window.