Maven Flashcards

Learning maven build system

1
Q

Maven project file?

A

pom.xml

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

How to find maven version?

A

mvn -version

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

How to create a maven project from command line

A

mvn archetype:generate

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

What is group id of a maven project?

A

Company website in reverse order,
com.codebind
It is unique for an organization.

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

What is artifact id of a maven project

A

It is the project name, e.g.,

my-maven-project

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

What does eclipse work space contain

A

A collection of projects

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

How to create a new maven project in eclipse

A

File -> New -> project -> maven -> maven project

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

What to do after creating a maven project in eclipse?

A

Create a class in src/main/java package

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

What is the relationship between “maven build life cycle”, “maven phase” and a “maven goal”?

A

A maven build life cycle contains multiple maven phases.

A “maven phase” contains multiple “maven goals”.

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

What does a pom.xml file should contain at the minimum?

A

GAV
Group ID,
Artifact ID,
Version

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

In maven, where are directories named after groupID and artifactID?

A

Directory named artifactID is child of directory named groupID.

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

In maven, how is resultant jar file named?

A

It is named after artifactID.

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

How do u execute a maven goal?

A

If the goal is a part of a maven phase, specify both phase:goal, like,

mvn dependency:copy-dependencies

If the goal is not a part of any phase, just specify that goal, like,

mvn clean

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

What are important parts of maven directory structure?

A
  • src
    • main
      • java
      • resources
      • webapp
    • test
      • java
      • resources
  • target

main dir contains only business src code.
test dir contains test src code.
target dir contains compiled code and jars etc.

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

How are dependencies specified in pom.xml file?

A

G, A, V (1)

    G, A, V (2)

Each dependency ultimately names a jar file.

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

What is transitive dependency in maven?

A

Indirect dependency,
Dependency of a direct dependency.

If a project has a dependency on ABC. And ABC itself has dependency on XYZ. Then project has a transitive dependency on XYZ.

17
Q

What are 3 built in maven “build life cycle”?

A
  • default
  • clean
  • site
18
Q

Give some examples of maven “phases”.

A

Examples of maven phase are,

  • mvn validate
  • mvn compile
  • mvn test
  • mvn package
  • mvn install
  • mvn deploy
19
Q

What does creating a maven project mean?

A

It means creating a pom.xml file and a standard directory layout.

20
Q

How to list all maven archetypes to a file?

A

mvn archetype:generate > archetypes.txt

Ctl-C