Interface ExecutorRequest


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.
  • Field Details

  • Method Details

    • command

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

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

      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
    • userHomeDirectory

      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

      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

      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

      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
    • grabOutputAsString

      boolean grabOutputAsString()
      Whether execution outputs (STDOUT and STDERR) should be captured as plain String. By default, this is true, unless client manually sets any of stdOut() or stdErr() streams, in which case this value is set to false and caller must handle these streams manually.
    • stdIn

      Optional provider for STD in of the Maven. If given, this provider will be piped into std input of Maven. The stream is closed once tool execution is finished.
      Returns:
      an Optional containing the stdin provider, or empty if not specified.
    • stdOut

      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. The stream is closed once tool execution is finished.
      Returns:
      an Optional containing the stdout consumer, or empty if not specified.
    • stdErr

      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. The stream is closed once tool execution is finished.
      Returns:
      an Optional containing the stderr consumer, or empty if not specified.
    • skipMavenRc

      boolean skipMavenRc()
      Indicate if ~/.mavenrc should be skipped during execution.

      Affected only for forked executor by adding MAVEN_SKIP_RC environment variable

    • executionTimeout

      Optional<Duration> executionTimeout()
      The optional execution time limit. If set, and execution does not finish within the given time, it is considered failed and killed. If not set, no time limit is applied. Depending on implementation, the timeout detection may be imprecise.
    • toBuilder

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

      static ExecutorRequest.Builder 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.
    • discoverInstallationDirectory

      static Path discoverInstallationDirectory()
    • discoverUserHomeDirectory

      static Path discoverUserHomeDirectory()
    • getCanonicalPath

      static Path getCanonicalPath(Path path)