POM.xml in Maven

In the previous post, we have seen how to create the Maven project and import that into eclipse.  In this post, we will learn about one important component of Maven that is nothing but POM.Xml.

POM.xml in Maven:

  • POM stands for “Project Object Model”, which is an important unit of work in Maven.
  • It is a XML file, which contains information about project and configuration details which is used by Maven to build the project.
  • It is created by default during creation of Maven project.
  • To download jars into project, we add them in form of dependency tags by defining its groupid, artifact id,version etc.
  • POM can also contain different goals and plugins to achieve some desired actions.
  • In Maven 1, POM was known as project.xml. It is renamed to POM in Maven 2.
  • POM resides in the current directory i.e. at project level.
  • POM may keep increasing in size as the project grows but it makes developers’ jobs easier to maintain complex projects.

Project is the root element in the POM and it has 3 major sub-nodes.

Name Descrition
groupId It is id or say package which exists in POM. IT is generally unique in the project. e.g. com.testing.Mobile
artifactId It is basically the project name.The artifactId defines the artifact’s location within the repository.
version It is the project version.It is used within an artifact’s repository to separate versions from each other. e.g. com.testing.Mobile : Model 1.0 and com.testing.Mobile : Model 1.1

Below, we have shown a POM.xml File, which is containing the dependency for testng which is having project name testng, groupid org.testng and version 6.3.1. We can define multiple dependencies under a single <dependencies> tag.

It is also having a plugin for sure-fire report which is defined under <build> tag. In <suiteXmlFiles>, we are providing the path for testng.xml file


Ask Question
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Print Friendly, PDF & Email
Create a Maven Project and Import it into Eclipse
Create and run a maven project
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

1 Response

  1. September 1, 2015

    […] the previous post, we have learnt about the pom.xml. In this post, we will create a project and execute it through maven […]

Leave a Reply

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