If you're looking for Maven Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research Maven has a market share of about 75.7%. So, You still have opportunity to move ahead in your career in Maven Development. Mindmajix offers Advanced Maven Interview Questions 2021 that helps you in cracking your interview & acquire dream career as Maven Developer.
Maven Interview Questions and Answers
Q1: What is Maven?
Ans: In another word, Maven is a Java tool. If you want to create a sample project or skeleton project you can use Maven. It is an automated build tool. The Maven focused on simplicity that it generates intelligent starters and assumes intelligence defaults. It also covers build-oriented phases in Application Lifecycle Management i.e. testing, deployment, builds management, and release versioning.
Q2: How many project types available in Maven to choose from?
Ans: There is more than thousand Java project as there are templates, skeleton provided to you by Maven so that you do not have to remember a basic configuration detail or a basic setup of that particular type of project which Maven is going to give it to you. It includes examples like basic Java project, Spring Project, Spring MVC, Spring Web Flow, and Spring Boot.
Q3: Why should one use Maven?
Ans: It helps to setup project very quickly and it avoids complicated build files like build.xml. Maven required files like
; it serves the purpose for Maven only.
is a collection of dependencies of your 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.
It helps to not bundle all the jars in your package i.e. in your War file or Ear file because all of them are going store in the repository and wherever you install this application that repository will be used for any dependencies look up. So, your Jar file, War file or Ear file or your bundle deployment will be very light.
Q4: Maven advantages over Ant?
1. Maven uses Convention whereas ant uses Configuration. In Maven, convention means a standard layout suggested by Maven. If you want a skeleton project of sample Java application, so Maven is going to give you one set of folders and configurations for that Java applications whereas in the case of Ant you need to have lots of configurations.
2. Maven supports project modularization.
3. Maven also supports dependency management and migration.
Q5: What Maven creates for you?
1. Directory Name
3. Project home
4. Contains the
and all subdirectories.
6. Contains the deliverable Java source code for the project.
8. Contain the deliverable resources for the project.
10. Contains the testing Java source code.
12. Contains resources necessary for testing.
Q6: For whom this Maven course is for?
1 .Maven can use for the Intermediate Java develop
2 .It works for a large project or portfolio managers.
3. It helps to work for heavy users of libraries.
Q7: What are the Maven Phases?
1. The first phase is the Validate Phases. It checks whether everything is in order i.e. the configuration is running properly, the code is placed in a proper way. This kind of validation check is done in the validate phase.
2. The next comes the compiler phases. It compiles everything together and stores it.
3. The third comes to the test phases. Here we run the test cases which are specified for the code.
4. The fourth phase is the package phases. Package file ends up in Jar file or War file or Ear file depending on what we have specified on the
Subscribe to our youtube channel to get new updates..!
5. The fifth phase is the install phase. It installs to your local Maven repository.
6. The sixth phase is called the deploy phase.
Q8: What are the tenets of Maven?
1. Project oriented.
2. Dependency Management.
3. Reuse through centralized repositories.
4. Convention over Configuration.
5. Extensible through plugins.
Q9: What is the Projected Oriented Build in Maven?
1. Maven tools are build on the model as POM i.e. Project Object Model.
2. Supports single-inheritance tree like Java.
3. Defined as XML in
4. Every pom extends the super POM
Q10: What are POM Files in Maven?
Ans: All your code and resources are placed in the src directory.
The main/Java directory holds your project code.
1. Compiled code is placed in the largest directory.
2 .The test/Java directory holds your JUnit test code.
Maven Interview Questions And Answers For Experienced
Q11: What is Maven Archetypes? And what are the Project Types?
Ans: Archetypes are templates to create a variety of Java project structures, including web applications specific to a container such as Wildfly. In other words, it is a tool that creates the stuff you build the project on top of.
Q12: What are Maven’s main objectives?
1. It helps to make project build easy to work for the users.
2. It easily helps in to migrate from one feature to another or one folder to another.
3. It helps in the new development with proper series of guidelines.
4. It creates a flexible working system for the users. So that you can work uniformly and orderly.
Q13: What is Maven Repository?
Ans: In Maven a repository is used as a storage folder or a directory to store your projects, your files such as Jar, War or Ear files that can be later used by the Maven application or tool. It works as a whole library of the files that is easily accessible and can be easily located in your system without any trouble and then can be used by Maven.
Q14: How many repositories are there in Maven?
Ans: 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
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.
Q15: How to install Maven?
Ans: Make sure JDK is installed, and
variable is added as Windows environment variable.
variable in the Windows environment, and point it to your Maven folder.
Q16: What is the Maven Lifecycle?
Ans: Lifestyle executed in term of phases:
1. Maven Steps through phases.
2. Execution defined in terms of plugin goals.
3. Execution associated with phases.
4. Lifecycle completes when all phase executes successfully.
Q17: What is the system requirement for Maven?
Ans: Maven does not require any high configuration to use. It requires only very minimal and simple system requirements for the users:
1. Java Deployment Kit
4. Internet Connection
5. For interacting with the repository.
6. Downloading dependencies.
Q18: What is the method and installing process of Maven?
Ans: Download Maven from:
Choose the .zip format.
Extract Maven to:
/usr/local/maven – Unix / Linux
C:Program Filesmaven – Windows
Q19: What is Key Maven Command?
Ans: Maven as an application has a limited number of commands
“Command” is a way of invoking the maven lifecycle.
Other “Commands” are defined through plugins.
Q20: What is Maven Plugin?
Ans: Core Maven functionality is simplistic:
Really just a plugin execution framework.
Knows predefined lifecycle and how to execute plugins.
Plugins are dynamically downloaded and installed.
Plugins encapsulate build related functionality:
Define by name.
Contain a set of goals.
Plugins are invoked using the syntax:
Q21: What are the archetype goals?
Ans: Four goals 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.
Q22: What are Maven build plugins?
Antlr Plugin – Generates parsers that you can use in your code from a very concise domain-specific language.
QueryDSL Plugin – Interrogates your database and creates data access objects that you can use to write SQL- like queries in your Java code.
Test Report Plugins – Make cool report websites that show you how well your unit tests are covering your code.
Shade Plugin – Allow you to bundle all of your classes into an uber-Jar that is runnable. This way you can deploy just one artifact. Also, can change packages of your dependencies to work around conflicts.
Q23: What is the dependency scope in Maven?
Ans: Compile– The library is available while compiling and running, main code and test code.
Provided – The library is available at compile time but will not be packaged with your code at run-time. Typically this is used when running on an app-server that will provide its chosen version of the library to all running applications.
Runtime – The library is not around for compilation but is around at run-time.
Test – Only include the library when compiling/running unit tests.
System – Refer to a library on this computer by filename; useful for libraries built into system.
Q24: What is parent POMs?
1. Basically, these are parent projects without code.
2. Used by companies to define the set of libraries/versions, plugins they want their teams using.
3. Can have dependencies, build plugins, variables definitions, and even their own parent POM, forming a chain.
4. A great example is Spring Boot. You can extract it to create production-grade web services crazily fast.
Q25: What is Maven Artifact?
Ans: Maven Artifact consists of files like Jar file or War file that result in the expansion of the specific file in the Maven repository. The Jar file can use as an artifact in Maven. The Maven Artifact determined by a group ID name to run the Maven Artifact in the Maven. They can contain files like Ear, Jar, and War or Zip file as well. Maven Artifact is used for specifying applications to locate a name or package. It is usually stored in your system repository.
Q26: What is the sequence in which Maven searches for dependency libraries?
Ans: You can locate dependency in the local repository system of your software. Sometimes, it is difficult to locate or identify in the local repository. So, I can find or look in the central repository system and if it shows the dependency missing then one can look in remote repository to find the dependency. If it still shows the same thing repeatedly then the system will show error in finding the dependencies. And if the dependencies are found in the local repository then it will be automatically downloaded in the central repository for future use.
Q27: What are the things you need to define for each external dependency?
Ans: External Dependency plays an important part in the Maven software. It is an internal part of the system without which dependency cannot be located in a system. To specify the external dependency we need:
1. It requires a group ID duplicate to the library name.
2. It requires an artifact ID duplicate to the library name.
3. Mentioning of dependency scope in the system
4. Have to mention the system route corresponding to the project position.
Q28: What are the steps involved in project deployment?
Ans: 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.
Q29: What are the aspects Maven manages?
7. Mailing list
Q30: What is a goal in Maven terminology?
Ans: The goals mentioned here in the Maven suggests the managing and building process requires creating a project. There is no limitation to follow the goals in Maven; it can build as many phases as it wants with zero boundations. You directly achieve your goal without any kind of outside intervention.