QA Interview: Top 30: Maven Interview Questions for QA

Other Useful Links:

1. What do you mean by Maven?

  • Maven is an Apache project management tool that provides a complete build cycle architecture. It is free and open source, and it is primarily used in Java projects.


2. Advantages of Maven

  • Maven keeps a consistent directory structure across all of its clients.
  • Maven is responsible for both deployment and build.
  • Because it is controlled by a POM file, it is simple to comprehend, set up, and utilise.
  • There's no need to add jar files to the project manually. Maven updates the project and transitive dependencies automatically.


3. Identify the Maven-managed characteristics.

  • Distribution, documentation, dependencies, builds, SCMs, reporting, mailing lists, and releases are all controlled via Maven.


4. What build tool is responsible for?

  • The primary function of build tools is to generate source code. It uses source code to generate documentation for projects.
  • It compiles source code and packages it as a JAR file. Finally, the code is stored locally, centrally, and remotely.


5. What does POM signify in Maven?

  • POM forms the elementary part of MavenA POM file in the current directory is searched and referred to while running a Maven goal or task to collect project information.
  • Plugins, profiles, developers, dependencies, goals, versions, and mailing lists are all contained in this XML file.


6. What is a Maven Repository?

  • Maven repository is a directory where all relevant project artifacts, jars, libraries, and plugins are stored and easily accessible to Maven. There are three types of repositories:
    • Local Repository
    • Remote Repository
    • Central Repository


7. What are the various Maven repository types?


Maven repositories are divided into three categories:

  • Local Repository: 
    • The developer's local repository is where all of the project's materials are saved.
    • All of the dependency jars are stored in the local repository.
  • Remote Repository:
    • When Maven needs to download dependencies, it uses the remote repository, which is a repository on a server.
    • When something from the remote repository is needed, it is first downloaded to the local repository, then used.
  • Central Repository:
    • When dependencies are required and cannot be located in the local repository, the Maven community steps in.
    • Maven downloads the dependencies from central repo in the local repository when needed.


8. Name three Build Lifecycle in Maven
  • The Maven lifecycle is a set of stages that must be followed in order to build a project.. There are three built-in build lifecycles:
    • Default: Handles project deployment.
    • Clean: Handles project cleaning.
    • Site: Organizes the documentation for the project site.

9. What are the phases of a Clean Life Cycle?
  • The following are the phases of a clean life cycle:
    • Pre-clean
    • Clean
    • Post-clean

10. What are the phases of a Site Life Cycle?
  • The following are the phases of a site life cycle:
    • Pre-site
    • Site
    • Post-site
    • Site-deploy

11. Explain Maven Build lifecycle phases.
  • Each of these build lifecycles has its own set of build phases, each of which represents a particular point in the lifecycle.
    • Validate: Verify that the project is correct and that the required information is present.
    • Compile: Compile the project's source code.
    • Test: Using a good unit testing framework, test the compiled source code. These tests should not necessitate packaging or deployment of the code.
    • Package: Take the compiled code and package it in a JAR or other distributable format.
    • Integration test: It executes the project's integration tests.
    • Verify: Examine the results of integration tests for quality criteria compliance.
    • Install: Add the package to the local repository so that it can be used as a dependency in other projects.
    • Deploy: Uploads the completed package to a remote repository so that it can be shared with other developers and projects.

12.1 Where are Maven dependencies stored?
  • Maven saves all JARs, dependent files, and other things it downloads in its local repository.
  • All artefacts are stored locally in the Maven local repository, which is a folder on the local machine.
  • The default location is.m2, which can be altered in the settings.xml file.

12.2 Can you explain what Maven external dependencies are?
  • Maven learns about the project's dependencies after reading the POM file.
  • It searches local, central, and distant repositories for these dependencies.
  • If a dependency isn't identified in these repos, Maven will use an external dependency.

13. What is meant by Maven Plugins?
  • Maven plugins are important Maven capabilities that allow you to reuse common build logic across several projects.
  • Compiling code, testing it, producing JAR files, and documenting projects are all processes that require plugins.

14. Why are Maven Plugins used?
Maven Plugins are used to:
  1. Create a JAR file.
  2. Create a WAR file.
  3. Compile code files.
  4. Unit testing of code.
  5. Create project documentation.
  6. Create project reports.

15. What are the types of Maven Plugins? There are two types of Maven Plugins:
  • Build plugins – These plugins are used throughout the build process and are configured in the pom.xml section.
  • Reporting plugins – These plugins are configured in the pom.xml element and are performed during stage generation.


        


Next: Maven Interview Questions for QA (16-30)


Greetings, reader! Your input is highly important to us. Please share your thoughts in the comments section below.


Contact:

Email:  piyushagrawal.automation@gmail.com

Follow on LinkedIn: Piyush Agrawal - LinkedIn

Follow on YouTube: Piyush Agrawal - Youtube

Happy to Help You !!

No comments:

Post a Comment