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 Link icon

    • NEXT_LINE Link icon

      protected static final Pattern NEXT_LINE
    • LAST_ANSI_SEQUENCE Link icon

      protected static final Pattern LAST_ANSI_SEQUENCE
    • ANSI_RESET Link icon

      protected static final String ANSI_RESET
      See Also:
  • Constructor Details Link icon

    • MavenInvoker Link icon

      public MavenInvoker(ProtoLookup protoLookup)
  • Method Details Link icon

    • execute Link icon

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

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

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

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

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

      protected void configureLogging(C context) throws Exception
      Overrides:
      configureLogging in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • determineBuildEventListener Link icon

      protected BuildEventListener determineBuildEventListener(C context)
    • doDetermineBuildEventListener Link icon

      protected BuildEventListener doDetermineBuildEventListener(C context)
    • customizeSettingsRequest Link icon

      protected void customizeSettingsRequest(C context, org.apache.maven.api.services.SettingsBuilderRequest settingsBuilderRequest)
      Overrides:
      customizeSettingsRequest in class LookupInvoker<C extends MavenContext>
    • customizeSettingsResult Link icon

      protected void customizeSettingsResult(C context, org.apache.maven.api.services.SettingsBuilderResult settingsBuilderResult) throws Exception
      Overrides:
      customizeSettingsResult in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • toolchains Link icon

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

      protected void populateRequest(C context, org.apache.maven.api.services.Lookup lookup, MavenExecutionRequest request) throws Exception
      Overrides:
      populateRequest in class LookupInvoker<C extends MavenContext>
      Throws:
      Exception
    • determinePom Link icon

      protected Path determinePom(C context, org.apache.maven.api.services.Lookup lookup)
    • determineReactorFailureBehaviour Link icon

      protected String determineReactorFailureBehaviour(C context)
    • determineGlobalChecksumPolicy Link icon

      protected String determineGlobalChecksumPolicy(C context)
    • determineExecutionListener Link icon

      protected ExecutionListener determineExecutionListener(C context)
    • determineTransferListener Link icon

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

      protected String determineMakeBehavior(C context)
    • performProjectActivation Link icon

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

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

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

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

      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 Link icon

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