Interface ExecutorRequest


@Immutable @Experimental public 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
  • Field Details

  • Method Details

    • command

      @Nonnull String command()
      The command to execute, ie "mvn".
    • arguments

      @Nonnull List<String> arguments()
      The immutable list of arguments to pass to the command.
    • cwd

      @Nonnull Path 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

      @Nonnull 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

      @Nonnull 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

      @Nonnull Optional<Map<String,String>> 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

      @Nonnull Optional<Map<String,String>> 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

      @Nonnull Optional<List<String>> 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 in arguments(), 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 in arguments(), 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

      @Nonnull default ExecutorRequest.Builder toBuilder()
      Returns ExecutorRequest.Builder created from this instance.
    • mavenBuilder

      @Nonnull static ExecutorRequest.Builder mavenBuilder(@Nullable Path installationDirectory)
      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

      @Nonnull static Path discoverMavenHome()
    • getCanonicalPath

      @Nonnull static Path getCanonicalPath(Path path)