Package org.apache.maven.internal.impl
Class DefaultSession
java.lang.Object
org.apache.maven.internal.impl.AbstractSession
org.apache.maven.internal.impl.DefaultSession
- All Implemented Interfaces:
Session
,InternalSession
-
Constructor Summary
ConstructorDescriptionDefaultSession
(MavenSession session, org.eclipse.aether.RepositorySystem repositorySystem, List<RemoteRepository> repositories, MavenRepositorySystem mavenRepositorySystem, Lookup lookup, RuntimeInformation runtimeInformation) -
Method Summary
Modifier and TypeMethodDescriptiongetData()
int
getEffectiveProperties
(Project project) Each invocation computes a new map of effective properties.Returns the current maven versiongetPluginContext
(Project project) Returns the plugin context for mojo being executed and the specifiedProject
, never returnsnull
as if context not present, creates it.org.eclipse.aether.RepositorySystem
Gets the root directory of the session, which is the root directory for the top directory project.<T extends Service>
TgetService
(Class<T> clazz) Retrieves the service for the interfaceorg.eclipse.aether.RepositorySystemSession
Returns immutable system properties to use for interpolation.Gets the directory of the topmost project being built, usually the current directory or the directory pointed at by the-f/--file
command line argument.Returns immutable user properties to use for interpolation.toArtifactRepository
(RemoteRepository repository) org.eclipse.aether.graph.Dependency
toDependency
(DependencyCoordinate dependency, boolean managed) withLocalRepository
(LocalRepository localRepository) Creates a derived session using the given local repository.withRemoteRepositories
(List<RemoteRepository> repositories) Creates a derived session using the given remote repositories.Methods inherited from class org.apache.maven.internal.impl.AbstractSession
collectDependencies, collectDependencies, collectDependencies, createArtifact, createArtifact, createArtifactCoordinate, createArtifactCoordinate, createArtifactCoordinate, createArtifactCoordinate, createDependencyCoordinate, createDependencyCoordinate, createLocalRepository, createRemoteRepository, createRemoteRepository, deployArtifact, flattenDependencies, getArtifact, getArtifactPath, getDependency, getListeners, getNode, getNode, getPathForLocalArtifact, getPathForRemoteArtifact, getProject, getProjects, getRemoteRepository, installArtifacts, installArtifacts, isVersionSnapshot, parseVersion, parseVersionConstraint, parseVersionRange, registerListener, requireDependencyScope, requireLanguage, requirePackaging, requirePathScope, requireProjectScope, requireType, resolveArtifact, resolveArtifact, resolveArtifacts, resolveArtifacts, resolveArtifacts, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveVersion, resolveVersionRange, setArtifactPath, toArtifact, toArtifact, toArtifactRepositories, toArtifacts, toDependencies, toRepositories, toRepository, toRepository, unregisterListener
-
Constructor Details
-
DefaultSession
public DefaultSession(@Nonnull MavenSession session, @Nonnull org.eclipse.aether.RepositorySystem repositorySystem, @Nullable List<RemoteRepository> repositories, @Nonnull MavenRepositorySystem mavenRepositorySystem, @Nonnull Lookup lookup, @Nonnull RuntimeInformation runtimeInformation)
-
-
Method Details
-
getMavenSession
-
getLocalRepository
-
getRemoteRepositories
-
getSettings
-
getUserProperties
Description copied from interface:Session
Returns immutable user properties to use for interpolation. The user properties have been configured directly by the user, e.g. via the-Dkey=value
parameter on the command line.- Returns:
- the user properties, never
null
-
getSystemProperties
Description copied from interface:Session
Returns immutable system properties to use for interpolation. The system properties are collected from the runtime environment such asSystem.getProperties()
and environment variables (prefixed withenv.
).- Returns:
- the system properties, never
null
-
getEffectiveProperties
Description copied from interface:Session
Each invocation computes a new map of effective properties. To be used in interpolation.Effective properties are computed from system, user and optionally project properties, layered with defined precedence onto each other to achieve proper precedence. Precedence is defined as:
- System properties (lowest precedence)
- Project properties (optional)
- User properties (highest precedence)
profile > project
, hence active profile property may override project property.The caller of this method should decide whether there is a project in scope (hence, a project instance needs to be passed) or not.
- Parameters:
project
-Project
ornull
.- Returns:
- the effective properties, never
null
-
getMavenVersion
Description copied from interface:Session
Returns the current maven version- Returns:
- the maven version, never
null
-
getDegreeOfConcurrency
public int getDegreeOfConcurrency() -
getStartTime
-
getRootDirectory
Description copied from interface:Session
Gets the root directory of the session, which is the root directory for the top directory project.- See Also:
-
getTopDirectory
Description copied from interface:Session
Gets the directory of the topmost project being built, usually the current directory or the directory pointed at by the-f/--file
command line argument. -
getProjects
-
getPluginContext
Description copied from interface:Session
Returns the plugin context for mojo being executed and the specifiedProject
, never returnsnull
as if context not present, creates it. Implementation note: while this method return type isMap
, the returned map instance implementsConcurrentMap
as well. -
getData
-
withLocalRepository
Description copied from interface:Session
Creates a derived session using the given local repository.- Parameters:
localRepository
- the new local repository- Returns:
- the derived session
-
withRemoteRepositories
Description copied from interface:Session
Creates a derived session using the given remote repositories.- Parameters:
repositories
- the new list of remote repositories- Returns:
- the derived session
-
getService
Description copied from interface:Session
Retrieves the service for the interface- Throws:
NoSuchElementException
- if the service could not be found
-
getSession
-
getRepositorySystem
-
toArtifactRepository
- Specified by:
toArtifactRepository
in interfaceInternalSession
- Specified by:
toArtifactRepository
in classAbstractSession
-
toDependency
public org.eclipse.aether.graph.Dependency toDependency(DependencyCoordinate dependency, boolean managed) - Specified by:
toDependency
in interfaceInternalSession
- Specified by:
toDependency
in classAbstractSession
-