Read Best Maven Interview Questions and answers

What do you understand by maven software?

A powerful project management tool based on project object model is known as maven software. It helps in building projects, dependency, and documentation. Just like ANT does, it makes the build process simpler but is much more advanced than ANT. It is a build automation tool which is basically used for java projects. “Maven” is a Yiddish word which means “accumulator of knowledge”. It describes how actually software is built and also specifies its dependencies. In this, the conventional method is used for the build procedure. The Java libraries are dynamically downloaded by Maven. Even the projects are written in C#, Ruby, Scala and some other languages can be built and managed by Maven. A plug-in based architecture is used to build Maven which allows it to make use of any application which can be controlled through any standard input.

What are some problems which we face while the development of a project when Maven is not used?

Following is a list of some problems which we face while developing a project when Maven is not used: –

Addition of set of jars in each project: when struts, spring, hibernate frameworks are used then a set of jar files needs to be added in each project. All the dependencies of jars should also be included.

Creating a right project structure: for the execution of a project, a right project structure should be created in servlet, struts, etc. otherwise it won’t get executed.

Building and deployment of a project: the project should be built and deployed so that it works and provides us with the desired output.

List the differences between ANT and Maven.

The differences between ANT and Maven are listed below:

Formal conventions are not present in ANT, due to which we need to provide the information of the project structure. Whereas, Maven has conventions which are needed to place the source or compiled the code. And hence we don’t need to provide the information.

ANT is a procedural language which provides information about what to do and when to do. Whereas, Maven is a declarative language in which we define everything in the pom.xml file.

ANT does not contain any life cycle. Whereas, there is a life cycle in Maven.

ANT is a toolbox. Whereas, Maven is a framework.

ANT is mainly a build tool. Whereas, Maven is basically a management tool.

ANT scripts are not reusable. Whereas, Maven scripts are reusable.

ANT scripts are less preferred. Whereas, Maven scripts are more preferred.

Write the steps for installing Maven on windows.

Maven can be downloaded and installed on windows, linux, and MAC OS platforms. Here are the steps given for installing Maven on windows operating system. For installing Maven on windows, you need to perform the following steps:

What do you mean by Maven repository and its types?

A directory of packaged JAR file which also consists of pom.xml file is called a Maven repository. Dependencies are being searched in the Maven repositories. There are basically three types of repositories. They are –

Local repository: the local repository of Maven is located in the local system. It is created in the system when any Maven command is run.

Central repository: the central repository is located on the web. The apache Maven community creates this repository by itself.

Remote repository: the remote repository is also located on the web. It consists of such libraries which are missing from the central repository.

Maven first searches for the local repository, then the central and then the remote repository. If dependencies are not found, then Maven stops the execution and throws an error.

Throw some light on the pom.xml file in Maven.

Here, the full form of POM is project object model. This model consists of all the information about the project. It also consists of the configuration information for the Maven to build the project. It contains the dependencies, build directory, source directory, test source directory, plugin, goals, etc. First the pom.xml file is read and then only the goal is executed. Firstly this pom.xml file was named as project.xml file but after the release of the latest version, it was changed to pom.xml file. There are basically five elements which are used to create a pom.xml file. They are: