Maven
Maven
is a
build automation widely used tool primarily for Java projects.
Maven is
built using a plugin-based architecture that allows it to make use of any
application controllable through standard input. Theoretically, this would allow
anyone to write plugins to interface with build tools (compilers, unit test
tools, etc.) for any other language.
Maven
uses an XML file to describe the software project being built, its dependencies
on other external modules and components, the build order, directories, and
required plug-ins. It comes with pre-defined targets for performing certain
well-defined tasks such as compilation of code and its packaging. The Major
advantage of Maven is it dynamically downloads the libraries and plug-ins. The
public repositories and local repositories can be configured in settings.xml.
A
Project Object Model (POM) provides all the configuration for a single project.
General configuration covers the project's name, its owner and its dependencies
on other projects. One can also configure individual phases of the build
process, which are implemented as plugins. For example, one can configure the
compiler-plugin to use Java version 1.5 for compilation, or specify packaging
the project even if some unit test fails.
Larger
projects should be divided into several modules, or sub-projects, each with its
own POM. One can then write a root POM through which one can compile all the
modules with a single command. POMs can also inherit configuration from other
POMs. All POMs inherit from the Super POM by default configured as parent. The
Super POM provides default configuration, such as default source directories,
default plugins, and so on.
Maven
follows a pre defined phases in its lifecycle starting from downloading the
dependencies, compiling, testing, packaging to installing in repositories and
deploying. Following is the maven build lifecycle
Even
though a build phase is responsible for a specific step in the build lifecycle,
the manner in which it carries out those responsibilities may vary. And this is
done by declaring the plugin goals bound to those build phases. A plugin goal
represents a specific task (finer than a build phase) which contributes to the
building and managing of a project. It may be bound to zero or more build
phases. A goal not bound to any build phase could be executed outside of the
build lifecycle by direct invocation. The order of execution depends on the
order in which the goal(s) and the build phase(s) are invoked. For example, The
clean and package arguments are build phases, while the dependency :
copy-dependencies is a goal (of a plugin). Furthermore, a build phase can also
have zero or more goals bound to it. If a build phase has no goals bound to it,
that build phase will not execute. But if it has one or more goals bound to it,
it will execute all the goals.
Comments
Post a Comment