Javatpoint Logo

91-9990449935

 0120-4256464

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?

  • Builds
  • Documentation
  • Reporing
  • SCMs
  • Releases
  • Distribution
More details...

3) What are the advantages of Maven?

  • No need to add jar file in each project
  • Creates right directory structure
  • Builds and deploys the project
More details...

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?

  • Generates source code (if auto-generated code is used)
  • Generates documentation from source code
  • Compiles source code
  • Packages compiled code into JAR of ZIP file
  • Installs the packaged code in local repository, server repository, or central repository
More details...

6) What is the difference between Ant and Maven?

AntMaven
It is a tool box.It is a framework.
It is mainly a build tool.It is mainly a project management tool.
There is no life cycle.There is life 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.
More details...

7) 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.


8) What is repository?

A repository is a directory or place where all the jars and pom.xml file are stored. There are 3 types of repository in Maven:

  1. Local Repository
  2. Central Repository
  3. Remote Repository
More details...

9) What is local repository?

Maven local repository is created by maven in your local system when you run any maven command. More details...


10) What is central repository?

Maven central repository is created by maven community on the web. More details...


11) What is 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 libraries are missing from the central repository. More details...


12) What is POM?

POM stands for Project Object Model. The pom.xml file contains information of project and project configuration. More details...


13) What are the build phases in Maven?

  1. validate
  2. compile
  3. test
  4. package
  5. integration-test
  6. verify
  7. install
  8. deploy

14) What is the command to package maven project?


15) What is fully qualified artifact name of maven project?


16) What is archetype?

Archetype is the maven plugin. It creates the project structure.