KEMBAR78
Top Maven Interview Questions in 2020 | Edureka | PDF
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
INTERVIEW QUESTIONS FOR BEGINNERS
INTERVIEW QUESTIONS FOR THE INTERMEDIATE
www.edureka.co
INTERVIEW QUESTIONS FOR THE EXPERIENCED
www.edureka.co
What is a Maven?01.
Apache Maven is a software project management and comprehension tool. Based on the
concept of a project object model (POM), Maven can manage a project's build, reporting
and documentation from a central piece of information.
www.edureka.co
What are the main features of Maven?02.
• Simple and Fast
• Easy to learn
• Dependency management
• Multiple projects
• Large library
• Extensible
• Instant
www.edureka.co
What are the functions of a build tool?03.
• Generate
• Documentation
• Compile
• Package
• Install
www.edureka.co
Why should one use Maven?04.
It helps to setup project very quickly and it avoids complicated build files like build.xml.
www.edureka.co
List the differences between ANT and Maven.05.
www.edureka.co
Mention the steps for installing Maven.06.
• Maven can be downloaded and installed on windows, linux, and MAC OS platforms.
www.edureka.co
What does it mean when you say Maven uses
Convention over Configuration?
07.
• In case of Configuration, developers need to create the build processes manually and
has to specify each and every configuration in detail.
• Once a developer creates a project in Maven, it will automatically create a structure.
www.edureka.co
What are the aspects that Maven manages?08.
• Builds
• Documentation
• Reporting
• Dependencies
• SCMs
• Releases
• Distribution
• Mailing list
www.edureka.co
What is POM?9.
• POM stands for Project Object Model. It is fundamental Unit of Work in Maven.
www.edureka.co
What information does POM contain?10.
• project dependencies
• plugins
• goals
• build profiles
• project version
• developers
• mailing list
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
What is Maven artifact?11.
An artifact is a file, usually a JAR that gets deployed to a Maven repository. A Maven build
produces one or more artifacts, such as a compiled JAR and a "sources" JAR.
www.edureka.co
What is Maven Build Lifecycle?12.
A Build Lifecycle is a well-defined sequence of phases. It defines the order in which the
goals are to be executed. Each build phase consists of a sequence of goals.
www.edureka.co
Name the 3 build lifecycles of Maven.13.
• clean:cleans up artifacts created by prior builds.
• default (or build):This is used to build the application.
• site: generates site documentation for the project.
www.edureka.co
What is the command to quickly build your Maven
site?
14.
Type the command − mvn site
www.edureka.co
What would the command mvn clean do ?15.
This command removes the target directory with all the build data before starting the
build process.
www.edureka.co
What are the phases of a Maven Build Lifecycle?16.
• Validate
• Compile
• Test
• Package
• Integration test
• Verify
• Install
• deploy
www.edureka.co
What is a goal in Maven terminology?17.
A goal represents a specific task which contributes to the building and managing of a
project. It may be bound to zero or more build phases.
www.edureka.co
What would this command do mvn clean
dependency:copy-dependencies package?
18.
This command will clean the project, copy the dependencies and package the project
(executing all phases up to package).
www.edureka.co
What phases does a Clean Lifecycle consist?19.
The clean lifecycle consists of the following phases −
• pre-clean
• clean
• post-clean
www.edureka.co
What phases does a Site Lifecycle consist?20.
The phases in Site Lifecycle are −
• pre-site
• site
• post-site
• site-deploy
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co
What is a Maven Repository?21.
A repository is a place i.e. directory where all the project jars, library jar, plugins
www.edureka.co
What are the types of Maven repositories?22.
Maven repository are of three types: local, central, remote
www.edureka.co
What is the default location for your local
repository?
23.
~/m2./repository
www.edureka.co
What is Build Profile?24.
A Build profile is a set of configuration values which can be used to set or override
default values of Maven build
www.edureka.co
What are different types of Build Profiles?25.
• Per Project
• Per User
• Global
www.edureka.co
How can you activate profiles?26.
A Maven Build Profile can be activated in five ways
www.edureka.co
What is the sequence in which Maven searches for
dependency libraries?
27.
There are 4 steps in which Maven searches for dependenies
www.edureka.co
When does Maven use External Dependency
concept?
28.
Maven dependency management uses concept of Maven Repositories (Local, Central,
Remote).
www.edureka.co
What are the things you need to define for each
external dependency?
29.
External dependencies (library jar location) can be configured in pom.xml in same way as
other dependencies.
www.edureka.co
What are the types of Maven Plugins?30.
Maven provides following two types of Plugins − Build plugins and Reporting plugins
www.edureka.co
Why are Maven Plugins used?31.
Maven Plugins are used to −
• create jar file.
• create war file.
• compile code files.
• unit testing of code.
• create project documentation.
• create project reports.
www.edureka.co
What is Archetype?32.
Archetype is a Maven plugin whose task is to create a project structure as per its
template.
www.edureka.co
What is the command to create a new project
based on an archtype?
33.
mvn archetype:generate
www.edureka.co
What is SNAPSHOT in Maven?34.
SNAPSHOT is a special version that indicates a current development copy.
www.edureka.co
What is difference between Snapshot and Version?35.
In case of Version, if Maven once downloaded the mentioned version say
data-service:1.0, it will never try to download a newer 1.0 available in
repository.
www.edureka.co
What is transitive dependency in Maven?36.
Transitive dependency means to avoid needing to discover and specify the libraries that
your own dependencies require, and including them automatically.
www.edureka.co
What does dependency management mean in the
context of transitive dependency?
37.
It means to directly specify the versions of artifacts to be used when they are
encountered in transitive dependencies.
www.edureka.co
Does Maven determine what version of dependency will be used
when multiple version of an artifact are encountered? If yes, How?
38.
Maven determines what version of a dependency is to be used when multiple versions of
an artifact are encountered.
www.edureka.co
What is dependency scope? Name all the
dependency scope
39.
Dependency scope includes dependencies as per the current stage of the build.
Various dependency scopes are – compile, provided, runtime, test, system and
import.
www.edureka.co
www.edureka.co
What is the minimal set of information for matching a dependency references
against a dependencyManagement section ?
40.
{groupId,artifactId,type,classifier}.
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
How do you reference a property defined in your
pom.xml file?
41.
To reference a property defined in your pom.xml, the property name uses the names of
the XML elements
www.edureka.co
What are the default values for packaging element? If there is no
packaging element defined,What is the default value for that?
42.
Some of the valid packaging values are jar, war, ear and pom.
www.edureka.co
What is the use of execution element in pom file?43.
The <execution> element contains information's required for the execution of a plugin.
www.edureka.co
What is a project's fully qualified artifact name?44.
<groupId>:<artifactId>:<version>
www.edureka.co
What are the benefit of storing JARS/external
dependencies in local repository instead of remote
one?
45.
It uses less storage, it makes checking out project quicker, non need for versioning JAR
files.
www.edureka.co
How can you build your project offline?46.
Use the command − mvn o package.
www.edureka.co
What is a system dependency?47.
Dependency with scope system are always available and are not looked up in repository,
they are usually used to tell Maven about dependencies which are provided by the JDK or
the VM.
www.edureka.co
What is the use of optional dependency?48.
Any transitive dependency can be marked as optional using "optional" element.
www.edureka.co
What is a Mojo?49.
A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a
plugin is a distribution of one or more related mojos.
www.edureka.co
What are steps involved in project deployment?50.
There are 6 steps involved in project deployment
www.edureka.co
www.edureka.co

Top Maven Interview Questions in 2020 | Edureka

  • 1.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 2.
    INTERVIEW QUESTIONS FORBEGINNERS INTERVIEW QUESTIONS FOR THE INTERMEDIATE www.edureka.co INTERVIEW QUESTIONS FOR THE EXPERIENCED
  • 3.
  • 4.
    What is aMaven?01. Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. www.edureka.co
  • 5.
    What are themain features of Maven?02. • Simple and Fast • Easy to learn • Dependency management • Multiple projects • Large library • Extensible • Instant www.edureka.co
  • 6.
    What are thefunctions of a build tool?03. • Generate • Documentation • Compile • Package • Install www.edureka.co
  • 7.
    Why should oneuse Maven?04. It helps to setup project very quickly and it avoids complicated build files like build.xml. www.edureka.co
  • 8.
    List the differencesbetween ANT and Maven.05. www.edureka.co
  • 9.
    Mention the stepsfor installing Maven.06. • Maven can be downloaded and installed on windows, linux, and MAC OS platforms. www.edureka.co
  • 10.
    What does itmean when you say Maven uses Convention over Configuration? 07. • In case of Configuration, developers need to create the build processes manually and has to specify each and every configuration in detail. • Once a developer creates a project in Maven, it will automatically create a structure. www.edureka.co
  • 11.
    What are theaspects that Maven manages?08. • Builds • Documentation • Reporting • Dependencies • SCMs • Releases • Distribution • Mailing list www.edureka.co
  • 12.
    What is POM?9. •POM stands for Project Object Model. It is fundamental Unit of Work in Maven. www.edureka.co
  • 13.
    What information doesPOM contain?10. • project dependencies • plugins • goals • build profiles • project version • developers • mailing list www.edureka.co
  • 14.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 15.
    What is Mavenartifact?11. An artifact is a file, usually a JAR that gets deployed to a Maven repository. A Maven build produces one or more artifacts, such as a compiled JAR and a "sources" JAR. www.edureka.co
  • 16.
    What is MavenBuild Lifecycle?12. A Build Lifecycle is a well-defined sequence of phases. It defines the order in which the goals are to be executed. Each build phase consists of a sequence of goals. www.edureka.co
  • 17.
    Name the 3build lifecycles of Maven.13. • clean:cleans up artifacts created by prior builds. • default (or build):This is used to build the application. • site: generates site documentation for the project. www.edureka.co
  • 18.
    What is thecommand to quickly build your Maven site? 14. Type the command − mvn site www.edureka.co
  • 19.
    What would thecommand mvn clean do ?15. This command removes the target directory with all the build data before starting the build process. www.edureka.co
  • 20.
    What are thephases of a Maven Build Lifecycle?16. • Validate • Compile • Test • Package • Integration test • Verify • Install • deploy www.edureka.co
  • 21.
    What is agoal in Maven terminology?17. A goal represents a specific task which contributes to the building and managing of a project. It may be bound to zero or more build phases. www.edureka.co
  • 22.
    What would thiscommand do mvn clean dependency:copy-dependencies package? 18. This command will clean the project, copy the dependencies and package the project (executing all phases up to package). www.edureka.co
  • 23.
    What phases doesa Clean Lifecycle consist?19. The clean lifecycle consists of the following phases − • pre-clean • clean • post-clean www.edureka.co
  • 24.
    What phases doesa Site Lifecycle consist?20. The phases in Site Lifecycle are − • pre-site • site • post-site • site-deploy www.edureka.co
  • 25.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 26.
  • 27.
    What is aMaven Repository?21. A repository is a place i.e. directory where all the project jars, library jar, plugins www.edureka.co
  • 28.
    What are thetypes of Maven repositories?22. Maven repository are of three types: local, central, remote www.edureka.co
  • 29.
    What is thedefault location for your local repository? 23. ~/m2./repository www.edureka.co
  • 30.
    What is BuildProfile?24. A Build profile is a set of configuration values which can be used to set or override default values of Maven build www.edureka.co
  • 31.
    What are differenttypes of Build Profiles?25. • Per Project • Per User • Global www.edureka.co
  • 32.
    How can youactivate profiles?26. A Maven Build Profile can be activated in five ways www.edureka.co
  • 33.
    What is thesequence in which Maven searches for dependency libraries? 27. There are 4 steps in which Maven searches for dependenies www.edureka.co
  • 34.
    When does Mavenuse External Dependency concept? 28. Maven dependency management uses concept of Maven Repositories (Local, Central, Remote). www.edureka.co
  • 35.
    What are thethings you need to define for each external dependency? 29. External dependencies (library jar location) can be configured in pom.xml in same way as other dependencies. www.edureka.co
  • 36.
    What are thetypes of Maven Plugins?30. Maven provides following two types of Plugins − Build plugins and Reporting plugins www.edureka.co
  • 37.
    Why are MavenPlugins used?31. Maven Plugins are used to − • create jar file. • create war file. • compile code files. • unit testing of code. • create project documentation. • create project reports. www.edureka.co
  • 38.
    What is Archetype?32. Archetypeis a Maven plugin whose task is to create a project structure as per its template. www.edureka.co
  • 39.
    What is thecommand to create a new project based on an archtype? 33. mvn archetype:generate www.edureka.co
  • 40.
    What is SNAPSHOTin Maven?34. SNAPSHOT is a special version that indicates a current development copy. www.edureka.co
  • 41.
    What is differencebetween Snapshot and Version?35. In case of Version, if Maven once downloaded the mentioned version say data-service:1.0, it will never try to download a newer 1.0 available in repository. www.edureka.co
  • 42.
    What is transitivedependency in Maven?36. Transitive dependency means to avoid needing to discover and specify the libraries that your own dependencies require, and including them automatically. www.edureka.co
  • 43.
    What does dependencymanagement mean in the context of transitive dependency? 37. It means to directly specify the versions of artifacts to be used when they are encountered in transitive dependencies. www.edureka.co
  • 44.
    Does Maven determinewhat version of dependency will be used when multiple version of an artifact are encountered? If yes, How? 38. Maven determines what version of a dependency is to be used when multiple versions of an artifact are encountered. www.edureka.co
  • 45.
    What is dependencyscope? Name all the dependency scope 39. Dependency scope includes dependencies as per the current stage of the build. Various dependency scopes are – compile, provided, runtime, test, system and import. www.edureka.co
  • 46.
  • 47.
    What is theminimal set of information for matching a dependency references against a dependencyManagement section ? 40. {groupId,artifactId,type,classifier}. www.edureka.co
  • 48.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 49.
    How do youreference a property defined in your pom.xml file? 41. To reference a property defined in your pom.xml, the property name uses the names of the XML elements www.edureka.co
  • 50.
    What are thedefault values for packaging element? If there is no packaging element defined,What is the default value for that? 42. Some of the valid packaging values are jar, war, ear and pom. www.edureka.co
  • 51.
    What is theuse of execution element in pom file?43. The <execution> element contains information's required for the execution of a plugin. www.edureka.co
  • 52.
    What is aproject's fully qualified artifact name?44. <groupId>:<artifactId>:<version> www.edureka.co
  • 53.
    What are thebenefit of storing JARS/external dependencies in local repository instead of remote one? 45. It uses less storage, it makes checking out project quicker, non need for versioning JAR files. www.edureka.co
  • 54.
    How can youbuild your project offline?46. Use the command − mvn o package. www.edureka.co
  • 55.
    What is asystem dependency?47. Dependency with scope system are always available and are not looked up in repository, they are usually used to tell Maven about dependencies which are provided by the JDK or the VM. www.edureka.co
  • 56.
    What is theuse of optional dependency?48. Any transitive dependency can be marked as optional using "optional" element. www.edureka.co
  • 57.
    What is aMojo?49. A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a plugin is a distribution of one or more related mojos. www.edureka.co
  • 58.
    What are stepsinvolved in project deployment?50. There are 6 steps involved in project deployment www.edureka.co
  • 59.