top of page

Maven Tutorial

POM And Dependencies In Maven

What Is POM In Maven ?

Project Object Model abbreviated as 'POM' is a XML format file that contains details about project configurations and operations which are read by Maven to build a project.
It is a key to operate Maven. For most of the projects it contains default values.
Some specified configuration information, maven contains are dependencies, plugins, goals and so on, to build a project.
Here's a sample of pom.xml file :

<project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>MavenTestProject</artifactId> <version>0.0.1-SNAPSHOT</version> <!-- Add Dependencies--> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>4.0.0</version> </dependency> </dependencies> </project>

Elements used in pom.xml :
It is a root element of pom.xml file.
modelVersion refers the version of POM model that is being used in the project. Use modelVersion 4.0.0 for maven 2 and maven 3.
It is the id of the project group that would be unique. In above example I've given groupId as 'org.example' .
It is used to give name of the project you are building. E.g. 'MavenTestProject' .
This element contains the version number of of the project/libraries.
This element contains a complete list of defined dependency of project.
It defines dependency by using description of groupId, artifactId and version of required library.
It defines the scope for the maven project that can be compile, test, runtime and so on.
Dependencies in Maven
Dependencies are the external Java libraries required for project that adds the required library from the repositories.
If the dependencies are not found in local repository, maven downloads them from a central repository and keeps them in local repository.
Refer next page Creating A New Maven Project In Eclipse
bottom of page