Maven – Introduction to the POM
POM is an acronym for Project Object Model. The pom.xml file contains information of project and configuration information for the maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc.Maven reads the pom.xml file, then executes the goal.
Before maven 2, it was named as project.xml file. But, since maven 2 (also in maven 3), it is renamed as pom.xml.
POM also contains the goals and plugins. While executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, and then executes the goal. Some of the configuration that can be specified in the POM are following −
- project dependencies
- build profiles
- project version
- mailing list
Before creating a POM, we should first decide the project group (groupId), its name (artifactId) and its version as these attributes help in uniquely identifying the project in repository
It should be noted that there should be a single POM file for each project.
- All POM files require the project element and three mandatory fields: groupId, artifactId, version.
- Projects notation in repository is groupId:artifactId:version.
Refer YouTube link below for better Explanation