The easiest way to describe a POM in a maven project is, it is nothing but the core element of any maven project. Basically any maven project consists of one configurable file called pom.xml, which stands for the abbreviation Project Object Model. This pom.xml will always be located in the root directory of any maven project. This file represents the very basic and fundamental unit in maven.
The pom.xml basically contains the information related to the project which is built or to be built in. It contains all the necessary information about the configuration details, dependencies included and plug-ins included in the project. In simple, it contains the details of the build life cycle of a project.
Below are some of the configurations that can be handled in the pom.xml file :
A typical pom.xml of simple java project will look like as shown in the below figure.
A pom.xml will always start with the root element called
<project> under which all the other required configurations will be made. Developers should ensure to define the below list of elements which are known as maven co-ordinates before defining a pom.xml file:
Whenever it comes for executing a task for a project, maven scans through the entries made in the pom. Xml file. This will enable the maven to read all the configurations made, build profiles defined, repositories configured and all other important details and then executes the task accordingly.
NOTE : Actually pom.xml was earlier used in the name of project.xml in maven 1. As the maven 2 version was introduced, this was renamed to pom.xml
All the maven projects pom.xml files always extends the super pom.xml file. This super pom.xml basically defines a set of default configurations which is shared and used by all the maven projects. This super pom.xml is not required to be written by the developers. This will come as a default one with the maven installation.
A typical super pom.xml can be found in the attached file. Click on th link below to download.
Goal in maven is nothing but a particular task which leads to the compiling, building and managing of a project. A goal in maven can be associated to zero or more build phases. Only thing that matters is the order of the goals defined for a given project in pom.xml. Because, the order of execution is completely dependent on the order of the goals defined.