JUnit Installation Process

Adding JUnit 5 is a bit different. Because of the modular fashion of JUnit 5, a BOM is used to import all aspects. If only particular classes are needed, individual groups or artifacts can be specified.

To add JUnit 5 to Maven, add the following to pom.xml:

<dependency>
 <groupId>org.junit</groupId>
 <artifactId>junit-bom</artifactId>
 <version>5.2.0</version>
 <scope>test</scope>
 </dependency>

For Gradle, add the following to the build.gradle:

apply plugin: ‘java’

dependencies {

 implementation ‘org.junit:junit-bom:5.2.0’

 }

Although not typically needed, the raw jar file, which allows one to use the JUnit framework, is also accessible, if needed to manually put on the classpath.  JUnit 4 has the jar available to download directly. Junit 5 (as I am writing this) does not currently have the jar file premade, but one can easily compile the code and generate the jars.