Before following this tutorial, make sure you:
Make a Maven Project
Start by opening Eclipse and choosing a location for your workspace, as you usually would.
Go to
New > Project, expand the
Maven folder, and select
Maven project.
On the following window, click
Create a simple project (skip archetype selection), leave the rest alone, and click
Next. Fill in the Group ID and Artifact ID with whatever you like, as long as they are in Camel Case Like This (in case the formatting breaks: capitalize the start of each word, and
don't have spaces between words), and click
Finish.
Add JUnit to pom.xml
Once you have your Maven project, you should see a project folder named with your chosen
ArtifactID - expand it if it isn't already expanded. At the bottom, there should be a file called
pom.xml - double-click this file.
Inside the file, check if there's a
<dependencies> tag; if not, add
<dependencies> </dependencies>
. Between these two tags, post the code below, then save the file. (The code is found
here - as of this writing, 5.7.0-M1 is the most recent version, but you can check at that link to be sure.)
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -→
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.0-M1</version>
<scope>test</scope>
</dependency>
And that's it! Maven will handle the rest of the process for you, downloading the necessary packages automatically.
--
LiamBarrett - 10 Jul 2020