Interface Invoker

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
EncryptInvoker, ForkedMavenInvoker, LocalMavenInvoker, LookupInvoker, MavenInvoker, ResidentMavenInvoker

@Experimental public interface Invoker 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 construction and invocation of Maven commands and builds, and it fully parses arguments.

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(InvokerRequest invokerRequest)
    Invokes the Maven application using the provided InvokerRequest.
  • Method Details

    • invoke

      int invoke(@Nonnull InvokerRequest 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