Class ReactorStateWorkspaceReader

  • All Implemented Interfaces:
    org.eclipse.aether.repository.WorkspaceReader

    @Named("ide")
    @Singleton
    public class ReactorStateWorkspaceReader
    extends org.apache.maven.AbstractMavenLifecycleParticipant
    implements org.eclipse.aether.repository.WorkspaceReader
    A Maven WorkspaceReader, which contributes Maven artifacts from the current Maven workspace based on their saved state to the current Maven execution. This workspace reader is able to restore the state of Maven modules, which are not being built in the current Maven execution, but belong to the same Maven workspace, to enable standalone builds of submodules.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReactorStateWorkspaceReader​(org.apache.maven.project.ProjectBuilder projectBuilder)
      Constructs a new state-based workspace reader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterProjectsRead​(org.apache.maven.execution.MavenSession session)
      Initializes the workspace reader with the saved state of the Maven modules within the current Maven workspace.
      File findArtifact​(org.eclipse.aether.artifact.Artifact artifact)
      Determines the filesystem location of a Maven artifact.
      List<String> findVersions​(org.eclipse.aether.artifact.Artifact artifact)
      Determines the available versions of a Maven artifact.
      org.eclipse.aether.repository.WorkspaceRepository getRepository()
      Returns the underlying workspace repository information.
      • Methods inherited from class org.apache.maven.AbstractMavenLifecycleParticipant

        afterSessionEnd, afterSessionStart
    • Field Detail

      • WORKSPACE_READER_IDE_QUALIFIER

        public static final String WORKSPACE_READER_IDE_QUALIFIER
        The Maven-defined qualifier for custom workspace reader implementations.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ReactorStateWorkspaceReader

        @Inject
        public ReactorStateWorkspaceReader​(org.apache.maven.project.ProjectBuilder projectBuilder)
        Constructs a new state-based workspace reader.
        Parameters:
        projectBuilder - The builder for Maven projects from POMs.
    • Method Detail

      • afterProjectsRead

        public void afterProjectsRead​(org.apache.maven.execution.MavenSession session)
                               throws org.apache.maven.MavenExecutionException
        Initializes the workspace reader with the saved state of the Maven modules within the current Maven workspace. This is a Maven lifecycle hook, which is executed directly after the Maven session has read the project definitions of the Maven modules, but before it has started building the project.
        Overrides:
        afterProjectsRead in class org.apache.maven.AbstractMavenLifecycleParticipant
        Parameters:
        session - The current Maven execution.
        Throws:
        org.apache.maven.MavenExecutionException - if an error occurred while reading the saved state of the Maven modules.
      • getRepository

        public org.eclipse.aether.repository.WorkspaceRepository getRepository()
        Returns the underlying workspace repository information.
        Specified by:
        getRepository in interface org.eclipse.aether.repository.WorkspaceReader
        Returns:
        The underlying workspace repository information.
      • findArtifact

        public File findArtifact​(org.eclipse.aether.artifact.Artifact artifact)
        Determines the filesystem location of a Maven artifact.
        Specified by:
        findArtifact in interface org.eclipse.aether.repository.WorkspaceReader
        Parameters:
        artifact - The Maven artifact to determine the filesystem location for.
        Returns:
        The filesystem location of the Maven artifact.
      • findVersions

        public List<String> findVersions​(org.eclipse.aether.artifact.Artifact artifact)
        Determines the available versions of a Maven artifact.
        Specified by:
        findVersions in interface org.eclipse.aether.repository.WorkspaceReader
        Parameters:
        artifact - The Maven artifact to determine available version for.
        Returns:
        The list of available versions of the Maven artifact.