Maven Flashcards

1
Q

What is Maven ?

A

A build and dependency management tool for a Java project. It provides the developer the complete build lifecycle framework.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

POM stands for ?

A

Project Object Model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What Maven does ?

A

+ We can easily build a project using maven.
+ We can add jars and other dependencies of the project easily using the help of maven.
+ Maven provides project information (log document, dependency list, unit test reports etc.)
+ Maven is very helpful for a project while updating central repository of JARs and other dependencies.
+ With the help of Maven we can build any number of projects into output types like the JAR, WAR etc without doing any scripting.
+ Using maven we can easily integrate our project with source control system (such as Subversion or Git).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are POM (pom.xml) files ?

A

XML file that contains information related to the project and configuration information such as dependencies, source directory, plugin, goals etc.
Maven reads pom.xml file to accomplish its configuration and operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are dependencies ?

A

External libraries required for projects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are repositories ?

A

Directories of packaged jar files.

The local repository is just a directory on your machine hard drive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens if dependencies are not found in the local Maven repository ?

A

Maven will automatically download those dependencies from a central Maven repository and put them in your local repository.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Build Life Cylce ?

A

A build life cycle consists of a sequence of build phases, and each build phase consists of a sequence of goals.

If a lifecycle is requested executed by giving maven command, all build phases in that life cycle are executed also. If a build phase is requested executed, all build phases before it in the defined sequence are executed too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are Build Profiles ?

A

Build profiles are sets of configuration values which allows you to build your project using different configurations.

For example, you may need to build your project for your local computer, for development and test. To enable different builds you can add different build profiles to your POM files using its profiles elements and are triggered in the variety of ways.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are Build Plugins ?

A

Build plugins are used to perform specific goal.
You can add a plugin to the POM file. Maven has some standard plugins you can use, and you can also implement your own in Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are 3 build lifecyle of Maven ?

A

+ Clean: Cleans up artifacts that are created by prior builds.
+ Default (build): Used to create the application.
+ Site: For the project generates site documentation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Maven artifact ?

A

Usually, an artifact is a JAR file which gets arrayed to a Maven repository. One or more artifacts a maven build produces such as compiled JAR and a sources JAR.

Each artifact includes a group ID, an artifact ID and a version string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Maven repositories ? What are their types ?

A

A Maven repository is a location where all the project jars, library jars, plugins or any other particular project related artifacts are stored and can be easily used by Maven.

Their types are:

+ Local repository (your computer)
+ Remote repository (some server)
+ Central repository (the internet)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why Maven plugins are used ?

A
\+ Create a jar file
\+ Create war file
\+ Compile code files
\+ Unit testing of code
\+ Documenting projects
\+ Reporting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to exclude dependency ?

A

By using the exclusion element, dependency can be excluded.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the build phases in Maven ?

A
\+ Validate
\+ Compile
\+ Test
\+ Package
\+ Install
\+ Deploy
17
Q

List out the build, source and test source directory for POM in Maven ?

A
Build = Target
Source = src/main/java
Test = src/main/test
18
Q

List out what are the Maven’s order of inheritance ?

A

+ Parent Pom
+ Project Pom
+ Settings
+ CLI parameters

19
Q

Explain how to run test classes in Maven ?

A

To run test classes in Maven, you need surefire plugin, check and configure your settings in setting.xml and pom.xml for a property named “test.”