Package org.apache.maven.api.cli
Interface Invoker
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
EncryptInvoker
,ForkedMavenInvoker
,LocalMavenInvoker
,LookupInvoker
,MavenInvoker
,ResidentMavenInvoker
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 TypeMethodDescriptiondefault void
close()
Closes and disposes of thisInvoker
instance, releasing any resources it may hold.int
invoke
(InvokerRequest invokerRequest) 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
-