You are right place, If you are looking for maven interview questions and answers, get more confidence to crack interview by reading this questions and answers we will update more and more latest questions for you…
1. What is Maven?
Maven is a project management and comprehension tool. Maven provides developers a complete build life cycle framework. Development team will automatize the project's build infrastructure in virtually no time as wiz uses a customary directory layout and a default build life cycle.
2. What will it mean once you say wizard uses Convention over Configuration?
Maven uses Convention over Configuration which suggests developers aren't needed to form build method themselves. Developers don't got to mention every and each configuration details.
3. What are the aspects Maven manages?
Maven provides developers ways to manage following −
- mailing list
[ Related Article - Explain the Advantages and Disadvantages of Maven? ]
4. How does one understand the version of mvn you're using?
Type the following command −
5. What is POM?
POM stands for Project Object Model. It's fundamental Unit of Work in Maven. It is an XML file. It's continuously resides within the base directory of the project as English person.xml. It contains data regarding the project and numerous configuration details utilized by adept to create the project(s).
[ Related Article - What is POM in Selenium? ]
6. What information does POM contain?
POM contains the a number of the subsequent configuration info −
- project dependencies
- build profiles
- project version
- mailing list
7. What is Maven artifact?
An whole may be a file, sometimes a JAR that gets deployed to a expert repository. A expert build produces one or a lot of artifacts, like a compiled JAR and a "sources" JAR.
Each artifact has a group ID (usually a reversed domain name, like com.example.foo), an artifact ID (just a name), and a version string. The three together uniquely identify the artifact. A project's dependencies are specified as artifacts.
8. What is Maven Build Life cycle?
A Build Life cycle could be a well outlined sequence of phases that outline the order during which the goals are to be dead. Here phase represents a stage in life cycle.9. Name the 3 build life cycle of Maven.
The three build life cycles are −
clean:cleans up artifacts created by prior builds.
default (or build):This is employed to create the applying.
site: generates site documentation for the project.
10. What is the command to quickly build your Maven site?
Type the command −
11. What would the command mvn clean do ?
This is command removes the target directory with all the build data before starting the build process.
12. What are the phases of a Maven Build Life cycle?
Following are the phases −
validate − the project is correct and every one necessary info is accessible.compile − the ASCII text file of the project.test − check the compiled ASCII text file employing an appropriate unit checking framework. These tests mustn't need the code to be prepacked or deployedpackage − take to the compiled code and package it in its distributable format like a JAR.integration-test − method associate degreed deploy the package if necessary into surroundings wherever integration tests are often run.verify − to the run any checks to verify the package is valid and meets quality criteria.install − the package into the native repository, to be used as a dependency in different comes domestically.deploy − worn out associate degree integration or unleash surroundings, copies the ultimate package to the remote repository for sharing with different developers and comes.
13. What is a goal in Maven terminology?
A goal represents a particular task that contributes to the building and managing of a project. It may be absolute to zero or additional build phases. A goal not absolute to any building part can be dead outside of the build life cycle by direct invocation.
14. What would this command do mvn clean dependency:copy-dependencies package?
This command will clean the project, copy the dependencies and package the project (executing all phases up to package).
15. What phases does a Clean Life cycle consist?
The clean life cycle consists of the following phases −
16. What phases does a Site Life cycle consist?
The phases in Site Life cycle are −
17. What is Build Profile?
A Build profile could be a set of configuration values which might be accustomed set or override default values of expert build. Using a build profile, you'll be able to customize build for various environments like Production v/s Development environments.
18. What are different types of Build Profiles?
Build profiles are of three types −
Per Project − Defined in the project POM file and pom.xml.Per User − Defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml).Global − Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml)
19. How can you activate profiles?
A superstar Build Profile is activated in varied ways that −
- Explicitly using command console input.
- Through maven settings.
- Based on environment variables (User/System variables).
- OS Settings (for example, Windows family).
- Present/missing files.
20. What is a Maven Repository?
A repository is a place i.e. directory wherever all the project jars, library jar, plugins or the other project specific artifacts square measure hold on and might be employed by adept simply.
21. What types of Maven repository?
Maven repository square measure of 3 types: native, central, remote
22. What is local repository?
Maven native repository could be a folder location on your machine. It gets created after you run any ace command for the primary time. Maven native repository keeps your project's all dependencies (library jars, plugin jars etc).
23. What is the default location for your local repository?
24. What is the command to install JAR file in local repository?
25. What is Central Repository?
repository provided by the Maven community. the contains in a large number of commonly used libraries. When Maven does not find any dependency in a local repository, it starts searching in a central repository using the following URL: http://repo1.maven.org/maven2/.
26. What is a Remote Repository?
Sometimes, genius doesn't notice a mentioned dependency in a very central repository furthermore then it stops the build method and output error message to console. To prevent such state of affairs, genius provides an inspiration of Remote Repository that is that the developer's own custom repository containing needed libraries or alternative project jars.