Search code examples
javaintellij-ideajunitjunit5

Including JUnit 5 dependency in IntelliJ IDEA


From jetbrains blog:

IntelliJ IDEA supports the ability to actually run tests written for JUnit 5 – there’s no need to use the additional libraries (like the Gradle or Maven plugins for example), all you need is to include the JUnit 5 dependency.

I'm new to Java and IntelliJ IDEA and it's not clear to me what are the steps that I should do for making test using Junit 5.


Solution

  • If your project is Maven or Gradle based, the dependency is added via pom.xml or build.gradle, otherwise you just add the .jar files to the Module Dependencies.

    IDE can help you with that, press Alt+Enter on the red code:

    add library

    The following dependencies will be downloaded from the Maven repository and added to the classpath:

    deps