Enroll in Selenium Training

This is the second method to create a Maven project. But in this rather than creating a project outside eclipse and then inport in to eclipse, we will directly create a maven project in to eclipse.

Create a New Maven Project in Eclipse

  1. Open your eclipse and Go to File > New > Others.


  1. Select Maven Project and click on Next.


  1. Un-check the 'Use default Workspace location' and with the help of the Browse button choose your workspace where you would like to set up your Maven project.


  1. Select the archetype, for now just select the 'maven-aechetype-quickstart' and click on Next.


  1. Specify the Group Id & Artifact Id and click on Finish.


Note: Here the ‘artifactId‘ is your project name.

6) Go to the project location to see the newly created maven project. Now open the pom.xml file, which resides in the project folder. By default the POM is generated like this:

<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">





7) Look at the default folder structure of the Maven project.


Note: Test cases reside under the src > test > java > PackageName will only be considered as a test by Maven, rest will be ignored if you put your test cases in some other folder.

  1. Modify XML with the latest Junit and save the XML.

Note: In later chapters, we will learn why do we add dependencies and from where we get artifactId & version.

Run your first Maven Test

  1. Right-click on the pom.xml and go to Run As > Maven test.


  1. In the console window of Eclipse, you would see the information like this:


  1. Go to ‘SureFire Reports‘ folder and open the XML file.


  1. It will display the result of the JUnit test.


How to Create a New Maven Project
How to Create a New Maven Project
Previous Article
Send Reports Automatically to Email using Maven from Eclipse
Send Reports Automatically to Email using Maven from Eclipse
Next Article
Lakshay Sharma
I’M LAKSHAY SHARMA AND I’M A FULL-STACK TEST AUTOMATION ENGINEER. Have passed 16 years playing with automation in mammoth projects like O2 (UK), Sprint (US), TD Bank (CA), Canadian Tire (CA), NHS (UK) & ASOS(UK). Currently, I am working with RABO Bank as a Chapter Lead QA. I am passionate about designing Automation Frameworks that follow OOPS concepts and Design patterns.
Virender Singh's Photo
Virender Singh

Similar Articles