top of page

POM & 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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <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 :

​

project

It is a root element of pom.xml file.

​

modelVersion

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.

​

groupId

It is the id of the project group that would be unique.In above example I've given groupId as 'org.example' .

​

artifactID

It is used to give name of the project you are building.E.g. 'MavenTestProject' .

​

version

This element contains the version number of of the project/libraries.

​

dependencies

This element contains a complete list of defined dependency of project.

​

dependency

It defines dependency by using description of groupId,artifactId and version of required library.

​

scope

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