Maven Interview Questions

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

Maven Interview Questions And Answers

What is Maven

Maven is a project management and comprehension tool. Maven provides developers a complete build lifecycle framework. Development team can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle.

What are the aspects Maven manages?

Maven provides developers ways to manage following:

  1. Builds
  2. Documentation
  3. Reporting
  4. Dependencies
  5. SCMs
  6. Releases
  7. Distribution
  8. Mailing list

What are the phases of a Maven Build Lifecycle?

Phases Description
validate validate the project is correct and all necessary information is available
compile compile the source code of the project.
test test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
package take the compiled code and package it in its distributable format, such as a JAR
Integration-test process and deploy the package if necessary into an environment where integration tests can be run
verify run any checks to verify the package is valid and meets quality criteria
install install the package into the local repository, for use as a dependency in other projects locally
deploy done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

 

What is difference between Snapshot and Version?

In case of Version, if Maven once downloaded the mentioned version say data-service:1.0, it will never try to download a newer 1.0 available in repository. To download the updated code, data-service version is be upgraded to 1.1.

In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-SNAPSHOT) everytime app-ui team build their project.

What are the advantages of Maven?

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

What it does?

Maven simplifies the above mentioned problems. It does mainly following tasks.

It makes a project easy to build

It provides uniform build process (maven project can be shared by all the maven projects)

It provides project information (log document, cross referenced sources, mailing list, dependency list, unit test reports etc.)

It is easy to migrate for new features of Maven

Apache Maven helps to manage

  1. Builds
  2. Documentation
  3. Reporing
  4. SCMs
  5. Releases
  6. Distribution

What features should  a build tool have?

A build tool should have:

  1. Compile java code and build jar, war and ear files for deployment and release.
  2. Versioning and dependency management
  3. Run tests and report test results
  4. Run code quality check with Sonar, Checkstyle, Findbugs, etc.
  5. Environment property substitution
  6. Files generations ( wsdl, AspectJ, XSL,etc)
  7. Support for cross platform (UNIX Windows) and IDEs(eclipse, Netbeasn, Intellij)
  8. Proper documentation and support.

What is a transitive dependency in Maven?

Transitive dependency in Maven means that it is not necessary to discover and specify the libraries that our own dependencies require, Maven includes them automatically.

What is the difference between version and SNAPSHOT ? 

Maven will download  always the specified version. In case of SNAPSHOT Maven will download the latest SNAPSHOT.

What is a Mojo?

A mojo is a Maven plain Old Java Object . Mojo is associated with a Maven goal. A custom plugin is a set of related Mojos (or goals) in a single plugin artifact.

What does the Maven command mvn clean do?

This command erase the target directory with all the build data before starting the building process.

 

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox