Class ReactorStateSaveExtension


  • @Named("reactorstate-save")
    @Singleton
    public class ReactorStateSaveExtension
    extends org.apache.maven.AbstractMavenLifecycleParticipant
    A Maven Core Extension which saves the state of Maven executions afterwards and restores it beforehand.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String EXTENSION_ID
      The unique ID of this Maven Core Extension.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReactorStateSaveExtension​(org.apache.maven.project.MavenProjectHelper projectHelper, org.apache.maven.project.ProjectBuilder projectBuilder)
      Constructs a new instance.
    • Constructor Detail

      • ReactorStateSaveExtension

        @Inject
        public ReactorStateSaveExtension​(org.apache.maven.project.MavenProjectHelper projectHelper,
                                         org.apache.maven.project.ProjectBuilder projectBuilder)
        Constructs a new instance.
        Parameters:
        projectHelper - The helper for Maven-related operations on the current state.
        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
        Restores the saved state of the Maven projects and its Maven modules within the current Maven execution.
        Overrides:
        afterProjectsRead in class org.apache.maven.AbstractMavenLifecycleParticipant
        Parameters:
        session - The current Maven execution.
        Throws:
        org.apache.maven.MavenExecutionException - if an error occurred while restoring the saved state.
      • afterSessionEnd

        public void afterSessionEnd​(org.apache.maven.execution.MavenSession session)
                             throws org.apache.maven.MavenExecutionException
        Saves the current state of all Maven modules within the Maven execution. 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:
        afterSessionEnd in class org.apache.maven.AbstractMavenLifecycleParticipant
        Parameters:
        session - The current Maven execution.
        Throws:
        org.apache.maven.MavenExecutionException - if an error occurred while saving the current state.