Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

Maven Interview Questions and Answers For Freshers Part-3

Be First!

maven21.What is a Maven Repository?
A repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.

22.What types of Maven repository?
Maven repository are of three types: local, central, remote

23.What is local repository?
Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time. Maven local repository keeps your project’s all dependencies (library jars, plugin jars etc).

24.What is the default location for your local repository?

25.What is the command to install JAR file in local repository?
mvn install

26.What is Central Repository?
It is repository provided by Maven community. It contains a large number of commonly used libraries. When Maven does not find any dependency in local repository, it starts searching in central repository using following URL:

27.What is Remote Repository?
Sometimes, Maven does not find a mentioned dependency in central repository as well then it stops the build process and output error message to console. To prevent such situation, Maven provides concept of Remote Repository which is developer’s own custom repository containing required libraries or other project jars.

28.What is the sequence in which Maven searches for dependency libraries?
Following is the search pattern −

Step 1 − Search dependency in local repository, if not found, move to step 2 else if found then do the further processing.

Step 2 − Search dependency in central repository, if not found and remote repository/repositories is/are mentioned then move to step 4 else if found, then it is downloaded to local repository for future reference.

Step 3 − If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).

Step 4 − Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency).

29.Why are Maven Plugins used?
Maven Plugins are used to −

create jar file.

create war file.

compile code files.

unit testing of code

create project documentation.

create project reports.

30.What are the types of Maven Plugins?
Maven provides following two types of Plugins −

Build plugins − They execute during the build and should be configured in the <build/> element of pom.xml

Reporting plugins − They execute during the site generation and they should be configured in the <reporting/> element of the pom.xml



Leave a Reply