Apache Maven Interview Questions And Answers

apache maven interview questions and answers   Top 7 Apache Maven Interview Questions And Answers

1) What is Maven?

It is a build automation tool with which we can import all libraries and can also create project structures. In Maven we have many in-built templates. These templates are called archetypes. A Maven is basically a tool used to compile applications. It helps to develop and managing project structure or applications like deployment, clean, packaging, jar and many more features for the Java-based project.


2) What is POM.xml in Maven?

It is a collection of dependencies of the Java Project which one can specify to Maven and then Maven will download all of them from the internet and then store it to some repository i.e. local repository, central repository, and remote repository.


3) Why we need Maven?

● Maven helps to setup project very quickly and it avoids complicated build files. So it has POM.xml which have all the dependencies and easy to use.
● Maven did not bundle all the jars in the package i.e. in the War or Ear files as all of them are going to store in the repository. So the bundle deployment will be very light weight.


4) What Maven creates?

Maven creates following:
● Directory Name
● Purpose
● Project home
● Contains the POM.xml and all subdirectories.
● Contains the deliverable Java source code for the project.
● Contain the deliverable resources for the project.
● Src/main/Java
● Src/test/Java
● Src/test/resources
● Src/main/resources
● Contains the testing Java source code.
● Contains resources necessary for testing.


5) What is Archetypes in Maven?

Archetypes are the templates to create variety of Java project structures, including web applications specific to a container such as Wildfly.


6) What are the archetype goals in Maven?

Following four goals are associated with archetype plugin:
Create - creates using a quick-start template.
Generate - provide a menu of templates.
Create - from-project - creates an archetype from an existing project.
Crawl - searches the repository for archetype and updates catalog.


7) What are the different project types in Maven?

Following are the different project types:
● War
● Ear
● Jar
● JMS
● Android