Maven POM Concepts

Each project has a corresponding Project Object Model or POM file that is located in the root directory. Whenever a goal (a specific build task) has to be executed, Maven looks for the configuration details in POM.

  • Project details can be represented in the form of XML file called pom.xml.
  • It is the fundamental unit that contains information about the project.
  • It holds all the resources required for a build such as source code location, test source, dependency details such as external or internal dependency etc.

POM.xml takes minimal coordinate attributes as inputs for the project as groupId:artifactId:version.

POM stores the information such as the location of the source code and records any external dependencies. It describes what needs to be built as part of the project.

Maven Core Features

Maven works around the following core concepts

Project Object Model (POM) is the XML representation of the project where all the dependencies and configuration details are stored. POM plays a major role in ensuring that all the project resource references are maintained.

Build Life Cycles, Phases, Goals – Maven build process is composed of many build life cycles. Each life cycle has one or more phases. Each phase has one or many associated goals.

Dependencies and Repositories – Dependencies are external JAR files required for the project to work. Maven downloads these dependencies into the local, central or remote repository.

Build Plugin – Adding plugins to the POM file allows us to add new custom actions to be done during the build process.

Build Profile – Projects can be built differently by using different build profiles.

Why Maven Need?

Maven is a very popular build automation tool used for Java projects.

Often while working on a Java application, you might be handling numerous jar files. You will have to handle proper dependency, version inclusions, building, publishing as well as deploying the app. One of the efficient and hassle-free ways to deal with these activities is to use a automated build tool like Maven.

Maven is a comprehensive build management tool that helps developers in performing the following tasks related to any project.

  • Compiling the source code.
  • Running the test.
  • Packaging the code into jar files.

You can set up Maven on any OS environment.