Package org.apache.maven.api
Maven Core API
Dependency management
ArtifactCoordinates
instances are used to locate artifacts in a repository.
Each instance is basically a pointer to a file in the Maven repository, except that the version may not be
defined precisely.
Artifact
instances are the pointed artifacts in the repository.
They are created when resolving an ArtifactCoordinates
. Resolving is the process
that selects a particular version and downloads the artifact in the local repository.
There are two sub-interfaces, DownloadedArtifact
which is used when
an artifact has been resolved
DependencyCoordinates
instances are used to express a dependency.
They are a ArtifactCoordinates
completed with information about how the artifact will be used:
type, scope and obligation (whether the dependency is optional or mandatory).
The version and the obligation may not be defined precisely.
Dependency
instances are the pointed dependencies in the repository.
They are created when resolving a DependencyCoordinates
.
Resolving is the process that clarifies the obligation (optional or mandatory status),
selects a particular version and downloads the artifact in the local repository.
Node
is the main output of the dependency collection process.
it's the graph of dependencies. The above-cited Dependency
instances are the outputs of the
collection process, part of the graph computed from one or more DependencyCoordinates
.
DependencyScope
defines when/how a given dependency will be used by the
project. This includes compile-time only, runtime, test time and various other combinations.
Resolution
Version resolution is the process of finding, for a given artifact, a list of
versions that match the input version constraint
in the list of remote repositories. This is done either explicitly using the
VersionResolver
service, or implicitly when resolving
an artifact.
Artifact resolution is the process of resolving the version and then downloading the file.
Dependency collection builds a graph of Node
objects representing
all the dependencies.
The Dependency graph flattening process in Maven involves reducing a complex, multi-level dependency graph to a simpler list where only the most relevant version of each artifact (based on groupId and artifactId) is retained, resolving conflicts and eliminating duplicates to ensure that each dependency is included only once in the final build.
Dependency resolution is the process of collecting dependencies, flattening the result graph, and then resolving the artifacts.
Repositories
In Maven, repositories are locations where project artifacts (such as JAR files, POM files, and other resources) are stored and retrieved. There are two primary types of repositories:
- local repository: A directory on the developer's machine where Maven caches downloaded artifacts.
- remote repository: A central or distributed location from which Maven can download artifacts when they are not available locally.
When resolving artifacts, Maven follows this order:
- Check Local Repository: Maven first checks if the artifact is available in the local repository.
- Check Remote Repositories: If the artifact is not found locally, Maven queries the configured remote repositories in the order they are listed.
- Download and Cache: If Maven finds the artifact in a remote repository, it downloads it and stores it in the local repository for future use.
By caching artifacts in the local repository, Maven minimizes the need to repeatedly download the same artifacts, thus optimizing the build process.
Projects
Project
instances are loaded by Maven from the local
file system (those projects are usually about to be built) or from the local repository
(they are usually downloaded during dependency collection). Those projects are loaded
from a Project Object Model (POM).
Project Object Model or POM refers to the information describing
all the information needed to build or consume a project. Those are usually loaded from
a file named pom.xml
and loaded into a Model
instances.
Project aggregation allows building several projects together. This is only
for projects that are built, hence available on the file system. One project,
called the aggregator project will list one or more modules
which are relative pointers on the file system to other projects. This is done using
the /project/modules/module
elements of the POM in the aggregator project.
Note that the aggregator project is required to have a pom
packaging.
Project inheritance defines a parent-child relationship between projects. The child project will inherit all the information from the parent project POM.
-
ClassDescriptionA Maven artifact is a file, typically a JAR, that is produced and used by Maven projects.Partial identification of an
Artifact
in a Maven repository.Configuration constants.A result of collecting, flattening and resolvingDependencyCoordinates
s.ArtifactCoordinates
completed with information about how the artifact will be used.Indicates when the dependency will be used.AnArtifact
that has been resolved, i.e.ADependency
that has been resolved, i.e.Event sent by maven during various phases of the build process.The possible types of execution events.A dependency exclusion.Interface that defines some kind of enums that can be extended by Maven plugins or extensions.The option of a Java command-line tool where to place the paths to some dependencies.Represents a Java toolchain in the Maven build system.Language.A Maven lifecycle is a sequence of predefined phases that govern the build process of a Maven project.A phase alias, mostly used to support the Maven 3 phases which are mapped to dynamic phases in Maven 4.A link from a phase to another phase, consisting of a type which can beLifecycle.Link.Kind.BEFORE
orLifecycle.Link.Kind.AFTER
, and aLifecycle.Pointer
to another phase.A phase in the lifecycle.A listener for session events.The local repository is a directory on the developer's machine where Maven stores all the downloaded artifacts (such as dependencies, plugins, and project artifacts).AMojoExecution
represents a single execution of a Maven Plugin during a given build.Represents a dependency node within a Maven project's dependency collector.Defines a hierarchical visitor for collecting dependency node trees.Represents the packaging of a Maven project.Path scope.The option of a command-line tool where to place the paths to some dependencies.Represents a maven plugin runtimeInterface representing a Maven project which can be created using theProjectBuilder
service.Project scope.A remote repository is a central or distributed location from which Maven can download project dependencies, plugins, and other build artifacts.In Maven, repositories are locations where project artifacts (such as JAR files, POM files, and other resources) are stored and retrieved.Marker interface for all services provided by theSession
.The session to install / deploy / resolve artifacts and dependencies.A container for data that is specific to a session.Key used to query the session dataRepresents a toolchain in the Maven build system.A dependency'sType
is uniquely identified by aString
, and semantically represents a known kind of dependency.A version or meta-version of an artifact or a dependency.Version constraint for dependency.A range of versions.Represents range boundary.