Learn About the Project Object Model Tool in Maven

Project Object Model

In this article, we are going to discuss about the POM which is the fundamental unit of work in the Apache Maven tool. The full form of POM is Project Object Model. Maven tool obeys the Project Object Model where the project structure and contents are defined and declared in an xml file known as pom.xml. This xml file always exist in the base directory of the project with the file name as pom.xml.

Contents of POM
The pom.xml file contains the project level information as well as various configuration details which should be used by Apache Maven tool in order to build the project(s). POM file also contains the plugins and tasks which should be executed during building a project. Apache Maven tool looks for the POM in the current directory and reads it to fetch the required configuration information in order to execute the tasks or goals related to the project build. The following are some of the configuration which can be specified in the POM configuration file.
• Project dependencies
• Plugins
• Goals
• Build profiles
• Project version
• Developers
• Automated mailing list

Prerequisites for creating a POM file
There are some prerequisites before we can create a POM file for any project. These prerequisites are the project group (groupId), the Artifact ID or project name (artifactId) and its version. All of these attributes help in the unique identification of the project in the project repository. When we use eclipse to create a Maven project, it prompts to enter these details in a dialogue box as shown below.

Object Maven Projects

Example of POM file

In a multi-tier JAVA project environment, it should be noted that for every project there exists a single POM file and each of these projects require the project element and the three mandatory fields such as groupId, artifactId, and version. The projects notation in a repository is groupId: artifactId: version. The root element of the pom.xml file is project which has the three major sub nodes as follows:

S No




groupId The groupId represents an Id of the project’s group. This Id must be always unique amid an organization or a project. E.g., a technology company group com.edunoix.tech has all technology related projects.


artifactId The artifactId represents an Id of the project. It is the general name of the project. E.g., a consumer-technology. The groupId along with the artifactId define the artifact’s location within the repository.


version The version represents the version of the project. It is used along with the groupId within an artifact’s repository in order to separate versions from each other. The following are the examples.

com.edunoix.tech: consumer-technology: 1.0.0.

com.edunoix.tech: consumer- technology: 1.1.0.

Concept of Super POM
In a multi-tier project, all project POMs always inherit from a parent and there is no need to define it explicitly. This base POM is nothing but the Super POM that contains the values to be inherited by the child POM files. Apache Maven uses the effective POM which includes the configuration from the super or base POM along with the current project configurations in order to execute the required task or goal. Such a hierarchy of POMS helps developer to specify minimum possible configuration detail at the project level in the pom.xml file. Also, all these POM configurations can be overridden easily. We can execute the following command in order to look the default configurations of the super POM.

In the following example, we are going to use the pom.xml file which is created for the project “maven_demo” as explained before. We can use this POM file to execute the above maven help command for looking the default configurations of the super POM. We can open a console or windows command prompt to execute this command. The following will be the logs on the console post execution of the above command. Here, we can observe the effective POM used by the Maven tool.

Conclusion: –
In this tutorial, we discussed about the POM which is the fundamental unit of the Apache Maven tool. Also, we have demonstrated POM and super POM inheritance along with the creation of the effective POM through Maven tool to display its content.


Please enter your comment!
Please enter your name here