Maven Flashcards
What are Maven Project co-ordinates ?
groupId, artifactId and version
they should be unique to a project and all projects require them
What is a groupId ?
often the reverse domain name
e.g. com.company.bank
usually unique to an organisation
What is a projectId ?
the name of the project
what is the version ?
It is used within an artifact’s repository to separate versions from each other. For example −
com.company.bank:consumer-banking:1.0
com.company.bank:consumer-banking:1.1
What is the Super POM ?
The Super POM is Maven’s default POM. All POMs inherit from a parent or default (despite explicitly defined or not). This base POM is known as the Super POM, and contains values inherited by default.
What is an effective POM ?
the effective POM is when you combine the project POM with the POM inherited from a Parent POM
What is a Build Lifecycle ?
It is a well defined ordered sequence of phases .
In each phase, goals (means tasks) are executed.
What is a Maven goal ?
A goal represents a specific task which contributes to the building and managing of a project.
What are the three standard Maven Lifecycles ?
clean, build (default), site
What is the default Maven lifecycle ?
build
A Lifecycle consists of Phases. What Phases are present in the Clean Lifecycle ?
pre-clean
clean
post-clean
What is <repositories> used for in the POM ?</repositories>
Sometimes, Maven does not find a mentioned dependency in central repository as well. It then stops the build process and output error message to console. To prevent such situation, Maven provides concept of Remote Repository, which is developer’s own custom repository containing required libraries or other project jars.
<repositories>
<repository>
<id>companyname.lib1</id>
<url>http://download.companyname.org/maven2/lib1</url>
</repository>
<repository>
<id>companyname.lib2</id>
<url>http://download.companyname.org/maven2/lib2</url>
</repository>
</repositories>
What is a Maven Plugin ?
The Maven Plugin is what actually executes the Mavel goal (performs the task at hand)
to execute the syntax would be
mvn [plugin-name]:[goal-name]
e.g. mvn compiler:compile
What is a Milestone version vs Snapshot version ?
Maven versions come in two flavors: snapshots and milestones. Snapshots have a version but end in -SNAPSHOT or -LATEST. Everything else falls into the milestone category. Milestones are unmodifiable. Snapshots can be changed.
Explain what is Maven? How does it work?
Maven is a project management tool. It provides the developer a complete build lifecycle framework. On executing Maven commands, it will look for POM file in Maven; it will run the command on the resources described in the POM.