Class MavenInvoker<C extends MavenContext>

java.lang.Object
org.apache.maven.cling.invoker.LookupInvoker<C>
org.apache.maven.cling.invoker.mvn.MavenInvoker<C>
Type Parameters:
C - The context type.
All Implemented Interfaces:
AutoCloseable, Invoker
Direct Known Subclasses:
LocalMavenInvoker, ResidentMavenInvoker

public abstract class MavenInvoker<C extends MavenContext> extends LookupInvoker<C>
The "local" Maven invoker, that expects whole Maven on classpath and invokes it.
  • Field Details

    • NEXT_LINE

      protected static final Pattern NEXT_LINE
    • LAST_ANSI_SEQUENCE

      protected static final Pattern LAST_ANSI_SEQUENCE
    • ANSI_RESET

      protected static final String ANSI_RESET
      See Also:
  • Constructor Details

    • MavenInvoker

      public MavenInvoker(ProtoLookup protoLookup)
  • Method Details

    • execute

      protected int execute(C context) throws Exception
      Specified by:
      execute in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • prepareMavenExecutionRequest

      protected MavenExecutionRequest prepareMavenExecutionRequest() throws Exception
      Throws:
      Exception
    • lookup

      protected void lookup(C context) throws Exception
      Overrides:
      lookup in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • init

      protected void init(C context) throws Exception
      Overrides:
      init in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • postCommands

      protected void postCommands(C context) throws Exception
      Overrides:
      postCommands in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • customizeSettingsRequest

      protected void customizeSettingsRequest(C context, SettingsBuilderRequest settingsBuilderRequest) throws Exception
      Overrides:
      customizeSettingsRequest in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • customizeSettingsResult

      protected void customizeSettingsResult(C context, SettingsBuilderResult settingsBuilderResult) throws Exception
      Overrides:
      customizeSettingsResult in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • toolchains

      protected void toolchains(C context, MavenExecutionRequest request) throws Exception
      Throws:
      Exception
    • populateRequest

      protected void populateRequest(C context, Lookup lookup, MavenExecutionRequest request) throws Exception
      Overrides:
      populateRequest in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • determinePom

      protected Path determinePom(C context, Lookup lookup)
    • determineReactorFailureBehaviour

      protected String determineReactorFailureBehaviour(C context)
    • determineGlobalChecksumPolicy

      protected String determineGlobalChecksumPolicy(C context)
    • determineExecutionListener

      protected ExecutionListener determineExecutionListener(C context)
    • determineTransferListener

      protected org.eclipse.aether.transfer.TransferListener determineTransferListener(C context, boolean noTransferProgress)
    • determineMakeBehavior

      protected String determineMakeBehavior(C context)
    • performProjectActivation

      protected void performProjectActivation(C context, ProjectActivation projectActivation)
    • performProfileActivation

      protected void performProfileActivation(C context, ProfileActivation profileActivation)
    • doExecute

      protected int doExecute(C context, MavenExecutionRequest request) throws Exception
      Throws:
      Exception
    • logBuildResumeHint

      protected void logBuildResumeHint(C context, String resumeBuildHint)
    • getResumeFromSelector

      protected String getResumeFromSelector(List<MavenProject> mavenProjects, MavenProject firstFailedProject)
      A helper method to determine the value to resume the build with -rf taking into account the edge case where multiple modules in the reactor have the same artifactId.

      -rf :artifactId will pick up the first module which matches, but when multiple modules in the reactor have the same artifactId, effective failed module might be later in build reactor. This means that developer will either have to type groupId or wait for build execution of all modules which were fine, but they are still before one which reported errors.

      Then the returned value is groupId:artifactId when there is a name clash and :artifactId if there is no conflict. This method is made package-private for testing purposes.

      Parameters:
      mavenProjects - Maven projects which are part of build execution.
      firstFailedProject - The first project which has failed.
      Returns:
      Value for -rf flag to resume build exactly from place where it failed (:artifactId in general and groupId:artifactId when there is a name clash).
    • logSummary

      protected void logSummary(C context, ExceptionSummary summary, Map<String,String> references, String indent)