Package org.apache.maven.api.cli
Interface Invoker<R extends InvokerRequest<? extends Options>>
- Type Parameters:
R
- The specific type ofInvokerRequest
thisInvoker
can handle, extendingInvokerRequest
- 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 TypeMethodDescriptiondefault void
close()
Closes and disposes of thisInvoker
instance, releasing any resources it may hold.int
Invokes the Maven application using the providedInvokerRequest
.
-
Method Details
-
invoke
Invokes the Maven application using the providedInvokerRequest
. 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
Closes and disposes of thisInvoker
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 interfaceAutoCloseable
- Throws:
InvokerException
- if an error occurs while closing theInvoker
-