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:
ProtoSession
,Session
,InternalMavenSession
,InternalSession
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.maven.api.ProtoSession
ProtoSession.Builder
-
Field Summary
Fields inherited from class org.apache.maven.internal.impl.AbstractSession
lookup, repositories, repositorySystem, session
-
Constructor Summary
ConstructorDescriptionDefaultSession
(MavenSession session, org.eclipse.aether.RepositorySystem repositorySystem, List<RemoteRepository> remoteRepositories, MavenRepositorySystem mavenRepositorySystem, Lookup lookup, RuntimeInformation runtimeInformation) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the degree of concurrency for the build.getEffectiveProperties
(Project project) Each invocation computes a new map of effective properties.Returns the current maven version.getPluginContext
(Project project) Returns the plugin context for mojo being executed and the specifiedProject
, never returnsnull
as if context not present, creates it.getProject
(MavenProject project) May return null if the input project is null or is not part of the reactor.Retrieves a list of projects associated with the session.getProjects
(List<MavenProject> projects) Gets the root directory of the session, which is the root directory for the top directory project.Retrieves the settings for the current session.Returns the start time of the session.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.protected Session
newSession
(MavenSession mavenSession, List<RemoteRepository> repositories) protected Session
newSession
(org.eclipse.aether.RepositorySystemSession repoSession, List<RemoteRepository> repositories) toArtifactRepositories
(List<RemoteRepository> repositories) toArtifactRepository
(RemoteRepository repository) Methods inherited from class org.apache.maven.internal.impl.AbstractSession
collectDependencies, collectDependencies, collectDependencies, createArtifact, createArtifact, createArtifactCoordinates, createArtifactCoordinates, createArtifactCoordinates, createArtifactCoordinates, createDependencyCoordinates, createDependencyCoordinates, createLocalRepository, createProducedArtifact, createProducedArtifact, createRemoteRepository, createRemoteRepository, deployArtifact, flattenDependencies, getArtifact, getArtifact, getArtifactPath, getData, getDependency, getListeners, getLocalRepository, getNode, getNode, getPathForLocalArtifact, getPathForRemoteArtifact, getRemoteRepositories, getRemoteRepository, getRepositorySystem, getService, getSession, installArtifacts, installArtifacts, isVersionSnapshot, parseVersion, parseVersionConstraint, parseVersionRange, registerListener, requireDependencyScope, requireLanguage, requirePackaging, requirePathScope, requireProjectScope, requireType, resolveArtifact, resolveArtifact, resolveArtifact, resolveArtifact, resolveArtifacts, resolveArtifacts, resolveArtifacts, resolveArtifacts, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveVersion, resolveVersionRange, resolveVersionRange, setArtifactPath, toArtifact, toArtifact, toArtifacts, toDependencies, toDependency, toRepositories, toRepository, toRepository, unregisterListener, withLocalRepository, withRemoteRepositories
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.internal.impl.InternalSession
getArtifact, getArtifact, getDependency, getNode, getNode, getRemoteRepository, getRepositorySystem, getSession, toArtifact, toArtifact, toArtifacts, toDependencies, toDependency, toRepositories, toRepository, toRepository
Methods inherited from interface org.apache.maven.api.ProtoSession
toBuilder
Methods inherited from interface org.apache.maven.api.Session
collectDependencies, collectDependencies, collectDependencies, createArtifact, createArtifact, createArtifactCoordinates, createArtifactCoordinates, createArtifactCoordinates, createArtifactCoordinates, createDependencyCoordinates, createDependencyCoordinates, createLocalRepository, createProducedArtifact, createProducedArtifact, createRemoteRepository, createRemoteRepository, deployArtifact, flattenDependencies, getArtifactPath, getData, getListeners, getLocalRepository, getPathForLocalArtifact, getPathForRemoteArtifact, getRemoteRepositories, getService, installArtifacts, installArtifacts, isVersionSnapshot, parseVersion, parseVersionConstraint, parseVersionRange, registerListener, requireDependencyScope, requireLanguage, requirePackaging, requirePathScope, requireProjectScope, requireType, resolveArtifact, resolveArtifact, resolveArtifact, resolveArtifact, resolveArtifacts, resolveArtifacts, resolveArtifacts, resolveArtifacts, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveDependencies, resolveVersion, resolveVersionRange, resolveVersionRange, setArtifactPath, unregisterListener, withLocalRepository, withRemoteRepositories
-
Constructor Details
-
DefaultSession
public DefaultSession(@Nonnull MavenSession session, @Nonnull org.eclipse.aether.RepositorySystem repositorySystem, @Nullable List<RemoteRepository> remoteRepositories, @Nonnull MavenRepositorySystem mavenRepositorySystem, @Nonnull Lookup lookup, @Nonnull RuntimeInformation runtimeInformation)
-
-
Method Details
-
getMavenSession
- Specified by:
getMavenSession
in interfaceInternalMavenSession
-
getProjects
- Specified by:
getProjects
in interfaceInternalMavenSession
-
getProject
Description copied from interface:InternalMavenSession
May return null if the input project is null or is not part of the reactor.- Specified by:
getProject
in interfaceInternalMavenSession
-
toArtifactRepositories
- Specified by:
toArtifactRepositories
in interfaceInternalMavenSession
-
getSettings
Description copied from interface:Session
Retrieves the settings for the current session.- Specified by:
getSettings
in interfaceSession
- Returns:
- the settings instance
-
getUserProperties
Description copied from interface:ProtoSession
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.- Specified by:
getUserProperties
in interfaceProtoSession
- Returns:
- the user properties, never
null
-
getSystemProperties
Description copied from interface:ProtoSession
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.
).- Specified by:
getSystemProperties
in interfaceProtoSession
- 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.
- Specified by:
getEffectiveProperties
in interfaceSession
- Parameters:
project
-Project
ornull
.- Returns:
- the effective properties, never
null
-
getMavenVersion
Description copied from interface:Session
Returns the current maven version.- Specified by:
getMavenVersion
in interfaceSession
- Returns:
- the maven version, never
null
-
getDegreeOfConcurrency
public int getDegreeOfConcurrency()Description copied from interface:Session
Returns the degree of concurrency for the build.- Specified by:
getDegreeOfConcurrency
in interfaceSession
- Returns:
- the degree of concurrency
-
getStartTime
Description copied from interface:ProtoSession
Returns the start time of the session.- Specified by:
getStartTime
in interfaceProtoSession
- Returns:
- the start time as an Instant object, never
null
-
getRootDirectory
Description copied from interface:ProtoSession
Gets the root directory of the session, which is the root directory for the top directory project.- Specified by:
getRootDirectory
in interfaceProtoSession
- Returns:
- the root directory, never
null
- See Also:
-
getTopDirectory
Description copied from interface:ProtoSession
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.- Specified by:
getTopDirectory
in interfaceProtoSession
- Returns:
- the directory of the topmost project, never
null
- See Also:
-
getProjects
Description copied from interface:Session
Retrieves a list of projects associated with the session.- Specified by:
getProjects
in interfaceSession
- Returns:
- a list of projects, never
null
-
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.- Specified by:
getPluginContext
in interfaceSession
-
newSession
protected Session newSession(org.eclipse.aether.RepositorySystemSession repoSession, List<RemoteRepository> repositories) - Specified by:
newSession
in classAbstractSession
-
newSession
-
toArtifactRepository
- Specified by:
toArtifactRepository
in interfaceInternalMavenSession
-