Package org.apache.maven.api.cli
Interface ExecutorRequest
Represents a request to execute Maven with command-line arguments.
This interface encapsulates all the necessary information needed to execute
Maven command with arguments. The arguments are not parsed, they are just passed over
to executed tool.
- Since:
- 4.0.0
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe immutable list of arguments to pass to the command.command()
The command to execute, ie "mvn".cwd()
Returns the current working directory for the Maven execution.static Path
Returns the map of environment variables to set before executing process.static Path
getCanonicalPath
(Path path) Returns the Maven installation directory.Returns the list of extra JVM arguments to be passed to the forked process.Returns the map of Java System Properties to set before executing process.static ExecutorRequest.Builder
mavenBuilder
(Path installationDirectory) Returns new builder pre-set to run Maven.Optional consumer for STD err of the Maven.Optional consumer for STD out of the Maven.default ExecutorRequest.Builder
ReturnsExecutorRequest.Builder
created from this instance.Returns the user's home directory.
-
Field Details
-
MVN
The Maven command.- See Also:
-
-
Method Details
-
command
The command to execute, ie "mvn". -
arguments
The immutable list of arguments to pass to the command. -
cwd
Returns the current working directory for the Maven execution. This is typically the directory from which Maven was invoked.- Returns:
- the current working directory path
-
installationDirectory
Returns the Maven installation directory. This is usually set by the Maven launcher script using the "maven.home" system property.- Returns:
- the Maven installation directory path
-
userHomeDirectory
Returns the user's home directory. This is typically obtained from the "user.home" system property.- Returns:
- the user's home directory path
-
jvmSystemProperties
Returns the map of Java System Properties to set before executing process.- Returns:
- an Optional containing the map of Java System Properties, or empty if not specified
-
environmentVariables
Returns the map of environment variables to set before executing process. This property is used ONLY by executors that spawn a new JVM.- Returns:
- an Optional containing the map of environment variables, or empty if not specified
-
jvmArguments
Returns the list of extra JVM arguments to be passed to the forked process. These arguments allow for customization of the JVM environment in which tool will run. This property is used ONLY by executors that spawn a new JVM.- Returns:
- an Optional containing the list of extra JVM arguments, or empty if not specified
-
stdoutConsumer
Optional<OutputStream> stdoutConsumer()Optional consumer for STD out of the Maven. If given, this consumer will get all output from the std out of Maven. Note: whether consumer gets to consume anything depends on invocation arguments passed inarguments()
, as if log file is set, not much will go to stdout.- Returns:
- an Optional containing the stdout consumer, or empty if not specified.
-
stderrConsumer
Optional<OutputStream> stderrConsumer()Optional consumer for STD err of the Maven. If given, this consumer will get all output from the std err of Maven. Note: whether consumer gets to consume anything depends on invocation arguments passed inarguments()
, as if log file is set, not much will go to stderr.- Returns:
- an Optional containing the stderr consumer, or empty if not specified.
-
toBuilder
ReturnsExecutorRequest.Builder
created from this instance. -
mavenBuilder
Returns new builder pre-set to run Maven. The discovery of maven home is attempted, user cwd and home are also discovered by standard means. -
discoverMavenHome
-
getCanonicalPath
-