top of page

Introduction To Maven

What Is Maven ?

Maven is a project management and project build tool that is based on project object model(POM).

It eliminates N number of steps in the build process and makes one-step process to do a build.

Here is the pictorial representation of how maven works :

POM File

Maven

Read pom.xml

  • Read pom.xml file

  • Downloads dependencies defined in pom.xml into local repository from central or remote repository

  • Execute life-cycles,phases,goals, plugins etc defined in specific build path

Dependencies

Plugins

Life Cycles

Phases

Goals

Build Profiles

Maven Repository

Maven provides project information like log document,dependency list,unit test reports and so on.

JARs can be easily added using maven dependencies from maven repositories.

POM Files

Project Object Model(POM) files are in xml format that ccontains information related to project and configuration such as dependencies,source directory, plugin,goals and so on.Maven reads POM to accomplish its configuration and operations.

Build Life Cycles,Phases,Goals

Build life cycle is a set of sequential build phases and each build phase is a sequential set of goals.

Maven command is the name af a build cycle.

Build Profiles

It is a set of configuration values that allows to build project using different configurations.

Build Plugins

They are used to perform a specific goal which can de added in POM file.

Dependencies

These are the elements of POM file that are used to add external java libraries in the project.

Maven Repositories

These are directories of packaged JAR files with some metadata.This metadata enables maven to download dependencies recursively until all dependencies are downloaded and put into your local machine.

Maven has three kinds of repository :

  1. Local Repository

  2. Central Repository

  3. Remote Repository

Maven searches for dependencies in these repositories.First it searches in Local Repository then Central Repository then Remote Repository if Remote Repository is specified in  the POM.

Local Repository

It is a directory on the developer's machine that contains all the downloaded dependencies.

Maven only needs to download the dependencies once,even if multiple projects depend on them.

By default .m2 folder is Local repository.

Central Repository

Maven community has Central Repository.If any dependency is required for the project but not found in Local  Repository then maven downloads them from Central Repository i.e. 'https://mvnrepository.com/' .

Remote Repository

This repository is on web server from which maven can download dependencies and often used for hosting projects internal to organization.

Refer next page Installation Of Maven In Eclipse

bottom of page