Maven Interview Questions
In this post we will look at Maven Interview questions. Examples are provided with explanation.
Q: What do you mean by build tools?
A: Build tools are generally to transform source code into binaries - it organize source code, set compile flags, manage dependencies. Some of them also integrate with running unit test, doing static analysis, a generating documentation.
Q: Why do we use build tools or build automation?
A: In small projects, developers will often manually invoke the build process. This is not practical for larger projects, where it is very hard to keep track of what needs to be built, in what sequence and what dependencies there are in the building process. Using an automation tool allows the build process to be more consistent. Some build tools available-:
- For java - Ant,Maven,Gradle.
- For .NET framework - NAnt
- c# - MsBuild.
A: Advantages of maven are as follows -
- Quick project setup, no complicated build.xml files, just a POM and go all developers in a project use the same jar dependencies due to centralized POM. getting a number of reports and metrics for a project "for free" reduce the size of source distributions, because jars can be pulled from a central location
- Promotes modular design of code. by making it simple to manage mulitple projects it allows the design to be laid out into muliple logical parts, weaving these parts together through the use of dependency tracking in pom files. Enforces modular design of code.
Q: What do you mean by archetype?
A: Archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made.
Q: Can you create a custom archetype?
A: Yes we can create a custom archetype. For example, in our project we created a archetype which would create a custom maven projects with modules as DAO, SERVICE and WEB. These modules had the required dependencies. All project members used this archetype as it saved a lot of time and every one had same starting workspace.