Interface Executor
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
EmbeddedMavenExecutor,ForkedMavenExecutor
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.- Since:
- 4.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final StringMaven version string returned when the actual version of Maven cannot be determined. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closes and disposes of thisExecutorinstance, releasing any resources it may hold.intexecute(ExecutorRequest executorRequest) Invokes the tool application using the providedExecutorRequest.mavenVersion(ExecutorRequest executorRequest) Returns the Maven version that providedExecutorRequestpoint at (would use).
-
Field Details
-
IS_WINDOWS
static final boolean IS_WINDOWS -
UNKNOWN_VERSION
Maven version string returned when the actual version of Maven cannot be determined.- See Also:
-
-
Method Details
-
execute
Invokes the tool application using the providedExecutorRequest. 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:
- an integer representing the exit code of the execution (0 typically indicates success)
- Throws:
ExecutorException- if an error occurs during the execution process
-
mavenVersion
Returns the Maven version that providedExecutorRequestpoint 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. (key can beExecutorRequest.installationDirectory().- Parameters:
executorRequest- the request containing all necessary information for the execution- Returns:
- a string representing the Maven version or
UNKNOWN_VERSION - Throws:
ExecutorException- if an error occurs during the execution process
-
close
Closes and disposes of thisExecutorinstance, 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:
closein interfaceAutoCloseable- Throws:
ExecutorException- if an error occurs while closing theExecutor
-