Class ProtoSession

java.lang.Object
org.apache.maven.internal.impl.AbstractSession
org.apache.maven.cling.invoker.mvn.ProtoSession
All Implemented Interfaces:
Session, InternalSession

public class ProtoSession extends AbstractSession
  • Constructor Details

    • ProtoSession

      protected ProtoSession(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RepositorySystem repositorySystem, List<RemoteRepository> repositories, List<org.eclipse.aether.repository.RemoteRepository> resolverRepositories, Lookup lookup, org.apache.maven.cling.invoker.mvn.ProtoSession.Context context)
  • Method Details

    • create

      public static Session create()
    • create

      public static Session create(Map<String,String> userProperties, Map<String,String> systemProperties)
      Create a new session.
    • newSession

      protected Session newSession(org.eclipse.aether.RepositorySystemSession session, List<RemoteRepository> repositories)
      Specified by:
      newSession in class AbstractSession
    • getSettings

      public Settings getSettings()
      Description copied from interface: Session
      Retrieves the settings for the current session.
      Returns:
      the settings instance
    • getUserProperties

      public Map<String,String> 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

      public Map<String,String> getSystemProperties()
      Description copied from interface: Session
      Returns immutable system properties to use for interpolation. The system properties are collected from the runtime environment such as System.getProperties() and environment variables (prefixed with env.).
      Returns:
      the system properties, never null
    • getEffectiveProperties

      public Map<String,String> getEffectiveProperties(Project project)
      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)
      Note: Project properties contains properties injected from profiles, if applicable. Their precedence is 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 or null.
      Returns:
      the effective properties, never null
    • getMavenVersion

      public Version getMavenVersion()
      Description copied from interface: Session
      Returns the current maven version.
      Returns:
      the maven version, never null
    • getDegreeOfConcurrency

      public int getDegreeOfConcurrency()
      Description copied from interface: Session
      Returns the degree of concurrency for the build.
      Returns:
      the degree of concurrency
    • getStartTime

      public Instant getStartTime()
      Description copied from interface: Session
      Returns the start time of the session.
      Returns:
      the start time as an Instant object, never null
    • getTopDirectory

      public Path 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.
      Returns:
      the directory of the topmost project, never null
      See Also:
    • getRootDirectory

      public Path getRootDirectory()
      Description copied from interface: Session
      Gets the root directory of the session, which is the root directory for the top directory project.
      Returns:
      the root directory, never null
      See Also:
    • getProjects

      public List<Project> getProjects()
      Description copied from interface: Session
      Retrieves a list of projects associated with the session.
      Returns:
      a list of projects, never null
    • getPluginContext

      public Map<String,Object> getPluginContext(Project project)
      Description copied from interface: Session
      Returns the plugin context for mojo being executed and the specified Project, never returns null as if context not present, creates it. Implementation note: while this method return type is Map, the returned map instance implements ConcurrentMap as well.