Ant Maven And Gradle Interview Questions

Maven is a DevOps tool that reduces the efforts to be put in the build process. The tool helps companies increase their development standards and reduce the development time, concurrently. As we know, Maven is an immensely popular tool, and it is quite evident that it has great career potential. If you are looking to bag a DevOps job, this ‘Maven Interview Questions’ article is the right one for you.

This article will dig deep into helping you gain knowledge about several topics and crack the interview simultaneously.Â

What do you mean by Maven’s External Dependencies?

Once Maven reads through the pom file, it gets to know the list of dependencies for the project. It searches for these dependencies in Local, Central and Remote repositories. In case any of the dependencies are not found in any of the repositories, then Maven utilizes the external dependency.

What does it mean when you say Maven uses Convention over Configuration?

In Configuration, developers have to create the build processes manually, and they have to specify every configuration in detail. But, Maven uses convention where the developers need not create the build processes manually.

Also, for the convention, users do not need to specify the configuration in detail. Once a developer creates a project in Maven, then Maven will automatically create a structure. Developers have to place the files appropriately. There is no need to specify any configuration details in the pom.xml file.

17) List out what are the Maven’s order of inheritance?

The maven’s order of inheritance is

  • Parent Pom
  • Project Pom
  • Settings
  • CLI parameters
  • What are the different elements that Maven takes care of?

    In the process, it takes care of the following:

  • Builds
  • Dependencies
  • ReportsÂ
  • Distribution
  • Releases
  • Mailing list
  • What is meant by the term ‘Super POM’?

    Super POM refers to the default POM of Maven. The POMs of Maven can be derived from a parent or by default. To execute any particular objectives, effective POM is used.

    Super POM supports the developers to configure the pom.xml file with the least configurations.

    A Build profile is a set of configuration values which can be used to set or override default values of Maven build. Using a build profile, you can customize builds for different environments such as Production v/s Development environments.

    How Maven handles and determines what version of dependency will be used when multiple versions of an artifact are encountered?

    If two dependency versions are at the same depth in the dependency tree, the first declared dependency will be used. This is called dependency mediation.

    Explain what is a Maven artifact?

    Usually an artifact is a JAR file which gets arrayed to a Maven repository. Maven build produces One or more artifacts such as compiled JAR and a source JAR.

    Each artifact includes a group ID, an artifact ID and a version string.

    1 How does Maven Architecture work?

    Maven architecture works in three steps, which are as follows:

  • The first step is to read the pom.xml file.
  • Then, it downloads the dependencies defined in pom.xml into the local repository from the central repository.
  • Lastly, it creates and generates a report according to the requirements, and executes life-cycles, phases, goals, plugins, etc.
  • Dependencies appearing in the “api” configurations will be transitively exposed to consumers of the library, and as such will appear on the compile classpath of consumers. Dependencies found in the “implementation” configuration will, on the other hand, not be exposed to consumers, and therefore not leak into the consumers compile classpath.

    Every Gradle build is made up of one or more projects. What a project represents depends on what it is that you are doing with Gradle. For example, a project might represent a library JAR or a web application. It might represent a distribution ZIP assembled from the JARs produced by other projects. A project does not necessarily represent a thing to be built. It might represent a thing to be done, such as deploying your application to staging or production environments. Dont worry if this seems a little vague for now. Gradles build-by-convention support adds a more concrete definition of what a project is.

    Every Gradle project provides the task dependencyInsight to render the so-called dependency insight report from the command line. Given a dependency in the dependency graph, you can identify the selection reason and track down the origin of the dependency selection. You can think of the dependency insight report as the inverse representation of the dependency report for a given dependency.

    The settings.gradle is a Groovy script that defines build related settings and not project related. It is evaluated against a Settings object and with this Settings object, you can add sub projects to your build, modify the parameter from the command line (StartParameter) and access the Gradle object to register lifecycle handlers.

    Maven vs Gradle: Which Is Better? | Maven & Gradle Difference | Devops Tools Explained | Simplilearn

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *