Interface Executor

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ExecutorHelper
All Known Implementing Classes:
DockerExeExecutor, EmbeddedMavenExecutor, ExecutorHelperImpl, ForkedMavenExecutor, ProcessBuilderExecutorSupport, TestContainersExecutor

public interface Executor extends AutoCloseable
Defines the contract for a component responsible for executing a Maven tool using the information provided in an ExecutorRequest. This interface is central to the execution of Maven commands and builds, but it does not construct nor fully parses arguments.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
     
    static final String
    Maven version string returned when the actual version of Maven cannot be determined.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes and disposes of this Executor instance, releasing any resources it may hold.
    execute(ExecutorRequest executorRequest)
    Invokes the tool application using the provided ExecutorRequest.
    Returns the Maven version that this executor points at (would use).
  • Field Details

    • IS_WINDOWS

      static final boolean IS_WINDOWS
    • UNKNOWN_VERSION

      static final String UNKNOWN_VERSION
      Maven version string returned when the actual version of Maven cannot be determined.
      See Also:
  • Method Details

    • execute

      ExecutorResult execute(ExecutorRequest executorRequest) throws ExecutorException
      Invokes the tool application using the provided ExecutorRequest. This method is responsible for executing the command or build process based on the information contained in the request.
      Parameters:
      executorRequest - the request containing all necessary information for the execution
      Returns:
      ExecutorResult carrying the result of the execution
      Throws:
      ExecutorException - if an error occurs during the execution process
    • mavenVersion

      String mavenVersion() throws ExecutorException
      Returns the Maven version that this executor points at (would use). This operation, depending on the underlying implementation, can be costly. If a caller uses this method often, it is the caller's responsibility to properly cache returned values.
      Returns:
      a string representing the Maven version or UNKNOWN_VERSION
      Throws:
      ExecutorException - if an error occurs during the execution process
    • close

      void close() throws ExecutorException
      Closes and disposes of this Executor instance, releasing any resources it may hold. This method is called automatically when using try-with-resources statements.

      The default implementation does nothing. Subclasses should override this method if they need to perform cleanup operations.

      Specified by:
      close in interface AutoCloseable
      Throws:
      ExecutorException - if an error occurs while closing the Executor