Creating a maven project in eclipse for selenium

Maven is a build management tool which manages the library files (external library files like selenium jar file or POI Apache etc.), it also standardizes the project build process.

According to Apache Maven Project – Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

If you are not using maven then you have to manually add all the libraries (selenium jar file, POI file etc.) in the project. Using maven you can automate the process by adding the dependencies in a file known as pom.xml.

Maven also creates a standard directory structure for your project.

It can also be integrated with Jenkins where you can automate the process of building your automation code and then executing it.

The time I am writing this article the latest version of eclipse is Oxygen and for this version and above there is no need of installing the maven tool. It comes by default with eclipse.

Creating a project in eclipse:

  1. Navigate to File –>New –> other –> Maven Project. Click next.
  2. Select the workspace directory. Click next.
  3. Select the project type as maven-archetype-quickstart. Click next.

Selecting maven project type

4. Enter the Group Id (generally name of the organization) and Artifact Id (name of the project) for this project. Click Finish.

Group Id and Artifact Id in maven project

5. Directory structure after creating the project looks like below:

Default directory structure of maven

In case maven is adding an incorrect version of java in your project like below:

Incorrect java version selected in maven project

You can update this project to point to latest version of java by following below steps:

a) Right click JRE System Library –> Properties –> change the execution environment from dropdown to the desired version of JRE –> Click OK.

changing properties of a maven project

changing java version of a maven project

6. Now you are good to start adding code to the project. Java code is added in package src/main/java and test cases are added in src/main/test.

Adding Maven dependencies in Maven project:

There is a pom.xml file in your project. You can add the maven dependencies in that file under dependencies tag like below:


All the information about the dependencies you can get through official site of the respective product like from for Selenium Dependencies and so on.

After adding all the desired dependencies, save the file. Saving this file will download all the added library files and you can see them in Maven Dependencies folder in you project.

We are ready setting up maven project for selenium.

PS: For any queries or concerns please write to us @ or comment below. Happy Learning 🙂

Saurabh Dhingra

About the Author

Saurabh Dhingra

Follow Saurabh Dhingra: