Maven interview questions and answers explain project build management, dependency handling, and automation. Practice these structured questions and answers to improve your development workflow and efficiency.
A list of top frequently asked maven interview questions and answers are given below.
Maven is a project management tool. It is based on POM (Project Object Model). More details.
Type the following command on console to know the maven version.
More details.| Ant | Maven |
|---|---|
| It is a toolbox. | It is a framework. |
| It is mainly a build tool. | It is mainly a project management tool. |
| There is no life cycle. | There is alife cycle. |
| Ant doesn't have formal conventions. | Maven has a convention to place source code, compiled code etc. |
| Ant is procedural. | Maven is declarative. |
| The ant scripts are not reusable. | The Maven plugins are reusable. |
For providing probability to projects, we use profiles.
The syntax for project creation is:
mvn o packg.
It can be done using the following syntax:
The element is used to exclude dependencies.
The snapshot indicates the current development copy.
It is a Maven plugin which is designed for the creation of project structure.
It consists of a large number of libraries that are frequently used.
mvn install
The lifecycle of cleaning consist of:
The command removes the target directory before the starting of a build process.
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.
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:
Maven local repository is created by maven in your local system when you run any maven command. More details.
Maven community creates maven central repository on the web. More details.
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.
POM stands for Project Object Model. The pom.xml file contains information of project and project configuration. More details.
Archetype is the maven plugin. It creates the project structure.
We request you to subscribe our newsletter for upcoming updates.