Popular Maven Interview Questions And Answers

Popular Maven Interview Questions And Answers

Question: What is Maven?

Maven is a build automation tool used primarily for Java projects. Maven addresses two
aspects of building software:

First: It describes how software is built
Second: It describes its dependencies.
Unlike earlier tools like Apache Ant, it uses conventions for the build procedure, and only
exceptions need to be written down.

An XML file describes the software project being built, its dependencies on other external
modules and components, the build order, directories, and required plug-ins.
It comes with pre-defined targets for performing certain well-defined tasks such as
compilation of code and its packaging.

Maven dynamically downloads Java libraries and Maven plug-ins from one or more
repositories such as the Maven 2 Central Repository and stores them in a local cache.
This local cache of downloaded artifacts can also be updated with artifacts created by local
projects. Public repositories can also be updated.

Question: What Are Benefits Of Maven?

One of the biggest benefits of Maven is that its design regards all projects as having a
certain structure and a set of supported tasks work-flows.

Maven has quick project setup, no complicated build.xml files, just a POM and go
All developers in a project use the same jar dependencies due to centralized POM.
In Maven getting a number of reports and metrics for a project "for free"
It reduces the size of source distributions, because jars can be pulled from a central
Location Maven lets developers get your package dependencies easily
With Maven there is no need to add jar files manually to the class path.

Please Click on Download button to download this questions for your easy reference.

Question: What Are Build Life Cycles In Maven?

Build lifecycle is a list of named phases that can be used to give order to goal execution.
One of Maven's standard life cycles is the default lifecycle, which includes the following
phases, in this order
1 validate
2 generate-sources
3 process-sources
4 generate-resources
5 process-resources
6 compile
7 process-test-sources
8 process-test-resources
9 test-compile
10 test
11 package
12 install
13 deploy

Question: What Is Meant By Build Tool?

Build tools are programs that automate the creation of executable applications from source
code. Building incorporates compiling, linking and packaging the code into a usable or
executable form.

In small projects, developers will often manually invoke the build process. This is not
practical for larger projects.

Where it is very hard to keep track of what needs to be built, in what sequence and what
dependencies there are in the building process. Using an automation tool like Maven,
Gradle or ANT allows the build process to be more consistent.

Question: What Is Dependency Management Mechanism In Gradle?

Maven's dependency-handling mechanism is organized around a coordinate system
identifying individual artifacts such as software libraries or modules.
For example if a project needs Hibernate library. It has to simply declare Hibernate's
project coordinates in its POM. Maven will automatically download the dependency and the dependencies that Hibernate itself needs and store them in the user's local repository.
Maven 2 Central Repository is used by default to search for libraries, but developers can
configure the custom repositories to be used (e.g., company-private repositories) within the

Please Click on Download button to download this questions for your easy reference.

Question: What Is Central Repository Search Engine?

The Central Repository Search Engine, can be used to find out coordinates for different
open-source libraries and frameworks.

Question: What is Build Profile?

A Build profile is a set of configuration values which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as Production v/s Development environments.

Question: What are different types of Build Profiles?

Build profiles are of three types −
  • Per Project − Defined in the project POM file, pom.xml.
  • Per User − Defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml).
  • Global − Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml)

Question: How can you activate profiles?

A Maven Build Profile can be activated in various ways −
  • Explicitly using command console input.
  • Through maven settings.
  • Based on environment variables (User/System variables).
  • OS Settings (for example, Windows family).
  • Present/missing files.

Q: What are the steps involved in project deployment?

There are several steps to follow while implying project deployment in Maven. These steps include:
1. Go through all the projects and analyze the code that is working in the background in progress in the source code repository and identifies it.
2. In order to get the project development, one need to download the whole source code from the Social Venture Network.
3. Construct or develop the application in the system
4. It needs to be saving as a War or Jar file system.
5. Get the specified file from the location path and move that specific file to create a site.
6. The application that is created in the system needs to be updated with the latest version with date and version number.

Q: What are the aspects Maven manages?

1. Documentation
2. SCMs
3. Distribution
4. Builds
5. Reporting
6. Releases
7. Mailing list
8. Dependencies

Please Click on Download button to download this questions for your easy reference.

Question: What are Plugins In Maven?

Most of Maven's functionality is in plugins. A plugin provides a set of goals that can be
executed using the following syntax:
mvn [plugin-name]:[goal-name]

For example, a Java project can be compiled with the compiler-plugin's compile-goal by
running mvn compiler:compile . There are Maven plugins for building, testing, source
control management, running a web server, generating Eclipse project files, and much
more. Plugins are introduced and configured in a <plugins>-section of a pom.xml file.
Some basic plugins are included in every project by default, and they have sensible default

Questions: What Is Difference Between Maven And ANT?

Some of the major difference between Ant and Maven are

Ant is a tool box.
Maven is a framework.
There is no life cycle.
There is life cycle.
Ant doesn't have formal
Maven has a convention to place source code, compiled code
Ant is procedural.
Maven is declarative.
The ant scripts are not reusable.
The maven plugins are reusable.

Question: What is POM In Maven?

A Project Object Model (POM) provides all the configuration for a single project. General
configuration covers the project's name, its owner and its dependencies on other projects.
One can also configure individual phases of the build process, which are implemented
as plugins.

For example, one can configure the compiler-plugin to use Java version 1.5 for compilation,
or specify packaging the project even if some unit tests fail.
Larger projects should be divided into several modules, or sub-projects, each with its own
POM. One can then write a root POM through which one can compile all the modules with a
single command. POMs can also inherit configuration from other POMs. All POMs inherit
from the Super POM by default. The Super POM provides default configuration, such as
default source directories, default plugins, and so on.

Question: What Is Maven Archetype?

Archetype is a Maven project templating toolkit. An archetype is defined as an original
pattern or model from which all other things of the same kind are made.

Question: What Is Maven Artifact?

In Maven artifact is simply a file or JAR that is deployed to a Maven repository. An artifact
-Group ID
-Artifact ID
-Version string. The three together uniquely identify the artifact. All the project
dependencies are specified as artifacts.

Please Click on Download button to download this questions for your easy reference.

Question: What Is Goal In Maven?

In Maven a goal represents a specific task which contributes to the building and managing
of a project.

It may be bound to 1 or many build phases. A goal not bound to any build phase could be
executed outside of the build lifecycle by its direct invocation.

Question: How many repositories are there in Maven?

There are three types of repository present in Maven. This includes Local Repository, Central Repository, and Remote Repository.

Local Repository- This local repository is located on your local system and it works when you run a maven command. Maven local repository command is %USER_HOME%/.m2 directory.

Central Repository- Installation from the repository is performed on creating a project from archetype or resolving the dependency.

Remote Repository- This repository is located on the web. It is just a network accessible location that Maven downloads dependencies from. All the artifacts that remote repository contains are open source.

Question: What Is Build Profile?

In Maven a build profile is a set of configurations. This set is used to define or override
default behavior of Maven build.

Build profile helps the developers to customize the build process for different environments.
For example, you can set profiles for Test, UAT, Pre-prod and Prod environments each with
its own configurations etc.

Question: What Are Build Phases In Maven?

There are 6 build phases. -Validate -Compile -Test -Package -Install -Deploy

Question: What Is Target, Source & Test Folders In Maven?

Target: folder holds the compiled unit of code as part of the build process.
Source: folder usually holds java source codes. 
Test: directory contains all the unit testing codes.

Question: What Is Difference Between Compile & Install?

Compile: is used to compile the source code of the project Install:  installs the package
into the local repository, for use as a dependency in other projects locally. Design patterns
can also be used with Groovy. Here are important points.

Question: How to Activate Maven Build Profile?

A Maven Build Profile can be activated in following ways
Using command line console input.
By using Maven settings.
Based on environment variables (User/System variables).

Please Click on Download button to download this questions for your easy reference.



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post