Setting up JUnit 5 dependency with Maven Example


If you want to make use of the JUnit 5 dependency with your Java project to write your test cases, you will need to add the below relevant dependency XML code in your pom.xml file.

Add in pom.xml file:
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.9.3</version>
    <scope>test</scope>
</dependency>

You can choose the version based on your requirements. You can find the list here: https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api

Note: Make sure to load maven changes.

junit 5 example with maven

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap