Interface Invoker<R extends InvokerRequest<? extends Options>>

Type Parameters:
R - The specific type of InvokerRequest this Invoker can handle, extending InvokerRequest
All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
EncryptInvoker, ForkedMavenInvoker, LocalMavenInvoker, MavenInvoker<R>, ResidentMavenInvoker
All Known Implementing Classes:
DefaultEncryptInvoker, DefaultForkedMavenInvoker, DefaultLocalMavenInvoker, DefaultMavenInvoker, DefaultResidentMavenInvoker, LookupInvoker

@Experimental public interface Invoker<R extends InvokerRequest<? extends Options>> extends AutoCloseable
Defines the contract for a component responsible for invoking a Maven application using the information provided in an InvokerRequest. This interface is central to the execution of Maven commands and builds.

The Invoker is designed to be flexible, allowing for different implementations that can handle various types of InvokerRequests. It also implements AutoCloseable to ensure proper resource management.

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Closes and disposes of this Invoker instance, releasing any resources it may hold.
    int
    invoke(R invokerRequest)
    Invokes the Maven application using the provided InvokerRequest.
  • Method Details

    • invoke

      int invoke(@Nonnull R invokerRequest) throws InvokerException
      Invokes the Maven application using the provided InvokerRequest. This method is responsible for executing the Maven command or build process based on the information contained in the request.
      Parameters:
      invokerRequest - the request containing all necessary information for the invocation
      Returns:
      an integer representing the exit code of the invocation (0 typically indicates success)
      Throws:
      InvokerException - if an error occurs during the invocation process
    • close

      default void close() throws InvokerException
      Closes and disposes of this Invoker 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:
      InvokerException - if an error occurs while closing the Invoker