Interview Questions.

Maven Interview Questions and Answers

fluid

Maven Interview Questions and Answers

Q1. Briefly Explain What is Maven?

Ans: Maven is a construct automation tool or a venture management device. With Maven we are able to import all libraries and also can create venture structures. In Maven we have many inbuilt templates. These templates are referred to as archetypes. A Maven is essentially a device used to compile our applications. It helps to develop and handling venture structure or applications like deployment, clean, packaging, jar and plenty of more functions for the Java-primarily based project.

In some other word, it's far a Java tool. If you want to create a pattern task or skeleton venture you may use Maven. It is an automated construct device. The Maven focused on simplicity that it generates shrewd starters and assumes intelligence defaults. It additionally covers build-orientated phases in Application Lifecycle Management i.E. Trying out, deployment, builds control, and release versioning.

Q2. What is the usage of  Maven?

Ans:

It helps to setup undertaking in no time and it avoids complex construct documents like construct.Xml. Maven required files like POM.Xml; it serves the motive for Maven only. POM.Xml is a collection of dependencies of your Java Project which you could specify to Maven after which Maven will download all of them from the net after which store it to a few repository i.E. Neighborhood repository, principal repository, and far flung repository.

It helps to not package deal all the jars for your bundle i.E. To your War record or Ear report because they all are going keep inside the repository and wherever you put in this application that repository will be used for any dependencies appearance up. So, your Jar report, War document or Ear document or your package deal deployment might be very light.

Q3. What are Maven’s primary objectives?

Ans:

It helps to make challenge construct clean to work for the users.

It without problems enables in to migrate from one characteristic to every other or one folder to another.

It allows inside the new improvement with proper series of hints.

It creates a bendy working machine for the users. So that you could paintings uniformly and orderly.

Q4. List the Build levels in Maven.

Ans: There are 6 construct stages.

Validate.

Compile.

Test.

Package.

Install.

Deploy.

Q5. What is maven repository central.

Ans: It is the Maven hooked up repository. For instance, your POM specify the dependencies and it isn't available in the configured neighborhood and the remote repository then maven looks for the useful resource in Maven Central. Maven offers most of the frequent dependency resources at this far flung region.

Q6. What are the advantages of Maven over Ant?

Ans:

Maven uses Convention whereas ant makes use of Configuration. In Maven, convention approach a popular format cautioned by Maven. If you need a skeleton assignment of sample Java application, so Maven goes to give you one set of folders and configurations for that Java applications while inside the case of Ant you need to have masses of configurations.

Maven helps challenge modularization.

Maven also supports dependency management and migration.

Q7. Why Maven is used?

Ans:

• Create a jar document

• Create battle report

• Compile code

• Unit checking out of code

• Documenting initiatives

• Reporting

Q8. What is  MOJO?

Ans: Maven undeniable Old Java Object. Each mojo is an executable aim in Maven.

Q9. What is Maven artifact.

Ans: An artifact is a JAR, that receives deployed to a Maven repository.

Each artifact has a set ID , an artifact ID (artifact name) and a model string.

Q10. How do you rename a maven project?

Ans:

Rename the challenge the usage of Eclipse or different IDE.

Update the artifactId to your pom.Xml

Q11. What are the minimal necessities for a POM?

Ans: The minimum requirement for a POM are the following,

venture root

modelVersion

groupId

artifactId

model

Test listing is src/principal/take a look at that has all the unit trying out codes.

Q12.  Explain dependency:copy-dependencies goal.

Ans: This goal when executed copies all of the project's dependencies at the side of the transitive dependencies to the required folder.

Q13. How many undertaking sorts available in Maven to choose from?

Ans: There is more than thousand Java assignment as there are templates, skeleton provided to you by using Maven so that you do now not have to consider a fundamental configuration element or a basic setup of that precise type of undertaking which Maven goes to provide it to you. It consists of examples like primary Java project, Spring Project, Spring MVC, Spring Web Flow, and Spring Boot.

Q14.What is a intention in Maven terminology?

Ans: The desires noted here within the Maven indicates the managing and constructing technique requires creating a assignment. There is no obstacle to observe the dreams in Maven; it can construct as many stages as it wants with zero boundations. You immediately attain your intention without any type of out of doors intervention.

Q15. List the sorts of maven repository.

Ans: styles of maven repository

local.

Crucial.

And far flung.

Q16. Can we use one-of-a-kind name for POM.Xml?

Ans: Yes. You should point out file call the use of the -f alternative.

Mvn -f determine-pom.Xml

Q17. What is the method and putting in process of Maven?

Ans: Download Maven from:

https://maven.Apache.Org./download.Html

Choose the .Zip layout.

Extract Maven to:

/usr/local/maven – Unix / Linux

C:Program Filesmaven – Windows

Q18. Explain the highlevel listing shape of a maven task.

Ans:

goal folder holds the compiled unit of code as part of the build technique.

Source folder usually src/major/java holds java supply codes.

Test listing is src/principal/test that has all of the unit testing codes.

 

Q19. What jar:jar aim does?

Ans: It creates the jar files from the target/training directory with out recompiling any source lessons.
 

Q20. How do I bypass the assessments?

Ans: Include the parameter -Dmaven.Take a look at.Bypass=actual or -DskipTests=proper inside the command line.

Q21. How can I run a unmarried unit check?

Ans: Use the parameter -Dtest=MyTestClassName at the command line.

Q22. Difference among collect and install.

Ans: Compiler compiles the source code of the assignment whereas Install installs the package into the nearby repository, for use as a dependency in different tasks regionally.

Q23. Find info on the dependencies for the mission.

Ans:

the usage of command,

mvn dependency:tree

Q24. What is a Maven project's fully certified artifact call?

Ans: 

<groupId>:<artifactId>:<version>

Q25. Order by which Maven searches for the dependency.

Ans:

Local ->

Remote ->

Maven Central

 

Q26. What is groupId.

 

Ans: Identifies a undertaking uniquely across all tasks.
 

Q27. What is Maven plugin.

Ans: plugin is a distribution of 1 or extra related mojos.

POM.

POM (Project Object Model) is the fundamental unit of labor. It is an XML file which holds the facts about the project and configuration information used to construct a venture through Maven at the side of its dependencies.

Q28. What makes a fully certified name for the artifact? What uniquely identifies an artifact?

Ans: Three houses organization ID, artifact ID and the model string together identifies the artifact.

Q29. What are the stairs involved in project deployment?

Ans: There are several steps to comply with at the same time as implying challenge deployment in Maven. These steps include:

1. Go via all of the tasks and examine the code this is working within the background in development within the source code repository and identifies it.

2. In order to get the project improvement, one want to download the whole source code from the Social Venture Network.

Three. Construct or expand the software in the machine

4. It needs to be saving as a War or Jar document device.

5. Get the required document from the vicinity route and circulate that specific document to create a website.

6. The software this is created in the device needs to be updated with the latest model with date and model wide variety.

Q30. Explain the difference stages in Maven construct Lifecycle.

Ans: Maven build lifecycle is defined by using a listing of construct phases, where a build section represents a level within the lifecycle.

The default lifecycle accommodates of the following levels.

Validate - validates the assignment is accurate and all important facts is to be had.

Compile - bring together the source code of the assignment.

Take a look at - tests the compiled supply code using a suitable unit trying out framework. These assessments does not require the code to be packaged or deployed.

Package - take the compiled code and package deal it to its distributable layout, as an instance, JAR.

Affirm - runs any assessments on consequences of integration tests to ensure preferred satisfactory criteria are met.

Set up - installs the package into the neighborhood repository, for the usage of it as a dependency in other projects domestically.

Installation - completed in the construct surroundings, copies the very last bundle to the far off repository for sharing and collaboration with other members of the group and initiatives.




CFG