Maven is primarily a build automation tool used for building mostly Java projects and is maintained by the Apache Software Foundation. Maven, a Yiddish word meaning accumulator of knowledge, was originally started in Jakarta Turbine project.
Maven’s objectives (as per maven.apache.org) are:
Making the build process easy
Providing a uniform build system
Providing quality project information
Providing guidelines for best practices development
Allowing transparent migration to new features
Apart from building projects, maven also provides lot of additional functionality. Important functionalities of Maven are:
Build automation tool
Has a powerful repository system
Has an extensible plugin framework.
Implements best practices and follows convention over configuration approach.
Maven manages a project's build, reporting and even documentation through the project object model (POM), usually defined as pom.xml. POM is the object based representation of a build and contains project metadata (including the project coordinates such as group, artefact and version), dependencies, build settings etc. POM inheritance is also supported.
With Maven dependency management, you need to declare only your primary dependencies with their scope: compile time vs. runtime. Maven will then automatically include the dependencies needed by your dependencies and their dependencies (transitive dependencies).
Dependencies are downloaded from a maven remote repository and cached in a local repository. Maven first checks local repo and then remote repo. Default remote repository is called Maven Central Repository, but we may create private repositories. Maven repositories can be used by other tools such as Ivy and Gradle.
Maven lifecycle consists of various phases such as compile, test, package, deploy, install etc. defined by plugins (e.g. compiler plugin). Calling a phase executes all phases before it in the lifecycle. Maven goals are the tasks we define within each phase/plugin like packaging Jar, compile etc. Plugins are also dependencies and can be used to extend Maven functionalities.
Maven uses convention over configuration approach for the build procedure. Maven’s conventions follows the industry best practices with most reasonable defaults. Maven also suggests guidelines on how to layout your project’s directory structure. Understanding the defaults will help understand any Maven project easily.