Maven Flashcards
What is Maven ?
A build and dependency management tool for a Java project. It provides the developer the complete build lifecycle framework.
POM stands for ?
Project Object Model
What Maven does ?
+ 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).
What are POM (pom.xml) files ?
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.
What are dependencies ?
External libraries required for projects.
What are repositories ?
Directories of packaged jar files.
The local repository is just a directory on your machine hard drive.
What happens if dependencies are not found in the local Maven repository ?
Maven will automatically download those dependencies from a central Maven repository and put them in your local repository.
What is a Build Life Cylce ?
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.
What are Build Profiles ?
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.
What are Build Plugins ?
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.
What are 3 build lifecyle of Maven ?
+ Clean: Cleans up artifacts that are created by prior builds.
+ Default (build): Used to create the application.
+ Site: For the project generates site documentation.
What is Maven artifact ?
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.
What are Maven repositories ? What are their types ?
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)
Why Maven plugins are used ?
\+ Create a jar file \+ Create war file \+ Compile code files \+ Unit testing of code \+ Documenting projects \+ Reporting
How to exclude dependency ?
By using the exclusion element, dependency can be excluded.