YouTube Link: https://youtu.be/5iTcAR4fScM
**DevOps Certification Courses - https://www.edureka.co/devops-certification-training***
This video on 'Maven Interview Questions' discusses the most frequently asked Maven Interview Questions. This PPT will help give you a detailed explanation of the topics which will help you in acing the interviews.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
4. 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
5. 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
6. What are the functions of a build tool?03.
• Generate
• Documentation
• Compile
• Package
• Install
www.edureka.co
7. 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
9. Mention the steps for installing Maven.06.
• Maven can be downloaded and installed on windows, linux, and MAC OS platforms.
www.edureka.co
10. 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
11. What are the aspects 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 does POM contain?10.
• project dependencies
• plugins
• goals
• build profiles
• project version
• developers
• mailing list
www.edureka.co
15. 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
16. 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
17. 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
18. What is the command to quickly build your Maven
site?
14.
Type the command − mvn site
www.edureka.co
19. 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
20. What are the phases of a Maven Build Lifecycle?16.
• Validate
• Compile
• Test
• Package
• Integration test
• Verify
• Install
• deploy
www.edureka.co
21. 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
22. 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
23. What phases does a Clean Lifecycle consist?19.
The clean lifecycle consists of the following phases −
• pre-clean
• clean
• post-clean
www.edureka.co
24. What phases does a Site Lifecycle consist?20.
The phases in Site Lifecycle are −
• pre-site
• site
• post-site
• site-deploy
www.edureka.co
27. 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
28. What are the types of Maven repositories?22.
Maven repository are of three types: local, central, remote
www.edureka.co
29. What is the default location for your local
repository?
23.
~/m2./repository
www.edureka.co
30. 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
31. What are different types of Build Profiles?25.
• Per Project
• Per User
• Global
www.edureka.co
32. How can you activate profiles?26.
A Maven Build Profile can be activated in five ways
www.edureka.co
33. 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
34. When does Maven use External Dependency
concept?
28.
Maven dependency management uses concept of Maven Repositories (Local, Central,
Remote).
www.edureka.co
35. 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
36. What are the types of Maven Plugins?30.
Maven provides following two types of Plugins − Build plugins and Reporting plugins
www.edureka.co
37. 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
38. What is Archetype?32.
Archetype is a Maven plugin whose task is to create a project structure as per its
template.
www.edureka.co
39. What is the command to create a new project
based on an archtype?
33.
mvn archetype:generate
www.edureka.co
40. What is SNAPSHOT in Maven?34.
SNAPSHOT is a special version that indicates a current development copy.
www.edureka.co
41. 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
42. 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
43. 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
44. 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
45. 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
47. What is the minimal set of information for matching a dependency references
against a dependencyManagement section ?
40.
{groupId,artifactId,type,classifier}.
www.edureka.co
49. 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
50. 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
51. 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
52. What is a project's fully qualified artifact name?44.
<groupId>:<artifactId>:<version>
www.edureka.co
53. 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
54. How can you build your project offline?46.
Use the command − mvn o package.
www.edureka.co
55. 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
56. What is the use of optional dependency?48.
Any transitive dependency can be marked as optional using "optional" element.
www.edureka.co
57. 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
58. What are steps involved in project deployment?50.
There are 6 steps involved in project deployment
www.edureka.co