Create maven test and pom.xml – Maven in eclipse part 2

run-maven-test-n-pomxmlIn our previous article, we have seen how to configure or setup maven in eclipse.

In this article, we will see how to create a maven project and some basics of POM.xml.

  • How to create a Maven project in eclipse

on Eclipse IDE, File -> New -> Other…

Search for Maven and select “Maven Project”, click on Next


use default workspace or chose your location to the current project.

chose or leave the default Archetype,  click on Next


Enter Groupid -> This will identify your project, naming convention as like package name rules.

Enter Artifactid -> project name.

Maven project structure somewhat looks like below



Create class under src/test/java as usual way to run the maven test.

  • pom.xml – (Project Object Model)

It is an XML file that contains information about the project and configuration details used by Maven to build the project and resides in the base directory of current project.

configuration details can be –

  • project dependencies
  • plugins
  • goals
  • build profiles
  • project version
  • developers
  • mailing list

Project dependencies – contains all the dependency.

Navigate to to search for dependencies (for selenium, testNG etc) and include them into the pom.xml

Maven searches the local repository to check if all the dependency present or not, if not downloads it from online.

Sample selenium maven POM.xml can be found here

  • How to run maven test in eclipse

On eclipse, Right click on the current project…

Run As -> Maven test

If you want to change the default local repository location, refer here.

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *