Maven
Maven is a build tool for Java projects.
Concepts
- Projects are the units of work Maven manages.
- The POM (
pom.xml
) file is the core of a Maven project's configuration. - Project inheritance allows POMs to inherit from other POMs.
- By default, all POMs inherit the Super POM, unless the
/project/parent
element is specified.
- By default, all POMs inherit the Super POM, unless the
- Project aggregation is similar to inheritance, but specifies a child module (
/project/modules/module
) in the parent POM instead
- The POM (
- A BOM is a type of POM specifying dependencies which may itself be included for these transitive dependencies, centralising their management across numerous projects.
- Goals are similar to tasks in other build systems, and may accept parameters using the
-D
CLI argument. Goals are namespaced by the ID of the plugin which provides them. - Plugins provide goals or report types.
- Profiles as per-project, per-user, or global configurations which can be used to override portions of a POM.
- Phases define the categories of goals with a project's build lifecycle. Different packaging types will map different goals to different phases.
- Archetypes provide predefined templates which accept some user input to generate a skeleton project.
- A repository contains built artifacts and dependencies.
- Each user's local repository caches artifacts and dependencies to speed up subsequent installation.
- A remote repository may be accessed over a network.
- Maven uses two fields to identify projects:
groupId
is typically set to the organisation name.artifactId
is used to identify the project, relative to the groupId.
CLI
mvn
:
-B
or--batch-mode
is non-interactive.-D<property>=<value>
or--define <property>=<value>
set a system property value.-P profile1,profile2
specifies a comma-delimited set of profiles to activate.-o
or--offline
forces use of dependencies cached in the local repository.
Backlinks