Maven Interview Question
A list of top frequently asked maven interview questions and answers are given below.
1) What is Maven?
Maven is a project management tool. It is based on POM (Project Object Model). More details.
2) What aspects are managed by Maven?
3) What are the advantages of Maven?
4) What is the command to check the maven version?
Type the following command on console to know the maven version.More details.
5) What does the build tool?
6) What is the difference between Ant and Maven?
7) Why is the use of the profile required in Maven?
For providing probability to projects, we use profiles.
8) What is the syntax for offline project creation?
The syntax for project creation is:
mvn o packg.
9) How is the propagation of plugins to child POMs stopped?
It can be done using the following syntax:
10) What is the use of the exclusion element?
The element is used to exclude dependencies.
11) Define SNAPSHOT in terms of maven.
The snapshot indicates the current development copy.
12) Define Archetype.
It is a Maven plugin which is designed for the creation of project structure.
7. What does central repository consist of?
It consists of a large number of libraries that are frequently used.
13) Give the command for installation of the JAR file in a local repository.
14) Mention the phases of cleaning lifecycle.
The lifecycle of cleaning consist of:
15) What is the purpose of mvn clean command?
The command removes the target directory before the starting of a build process.
16) What is a MOJO?
A MOJO stands for Maven plain Old Java Object. Each MOJO is an executable goal in Maven, and a plugin is a distribution of one or more related MOJOs.
17) What is a repository?
A repository is a directory or place where all the jars and pom.xml file are stored. There are 3 types of a repository in Maven:
18) What is a local repository?
Maven local repository is created by maven in your local system when you run any maven command. More details.
19) What is a central repository?
Maven community creates maven central repository on the web. More details.
20) What is a remote repository?
Maven remote repository is located on the web by different vendors. So you need to define the dependency in pom.xml file manually. It is important because most of the libraries are missing from the central repository. More details.
21) What is POM?
POM stands for Project Object Model. The pom.xml file contains information of project and project configuration. More details.
22) What are the build phases in Maven?
23) What is the command to package maven project?
24) What is the fully qualified artifact name of maven project?
25) What is an archetype?
Archetype is the maven plugin. It creates the project structure.