Interface InvokerRequest

All Known Implementing Classes:
BaseInvokerRequest, EncryptInvokerRequest, MavenInvokerRequest, ShellInvokerRequest

@Immutable @Experimental public interface InvokerRequest
Represents a Maven invocation request, encapsulating all necessary information for invoking a Maven build or command. Arguments are parsed and exposed via methods.
Since:
4.0.0
  • Method Details

    • parserRequest

      @Nonnull ParserRequest parserRequest()
      The parser request this instance was created from.
    • parsingFailed

      boolean parsingFailed()
      Flag representing parser processing result: if there were some fatal errors during Parser.parseInvocation(ParserRequest) this method will return true and invoker should handle this request as "early failure".
    • embedded

      default boolean embedded()
      Returns true if this call happens in "embedded" mode.
      See Also:
    • 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
    • messageBuilderFactory

      default MessageBuilderFactory messageBuilderFactory()
      Shorthand for MessageBuilderFactory.
    • lookup

      default Lookup lookup()
      Shorthand for Lookup.
    • userProperties

      @Nonnull Map<String,String> userProperties()
      Returns a map of user-defined properties for the Maven execution. These properties can be set using the -D command-line option.
      Returns:
      an unmodifiable map of user properties
    • systemProperties

      @Nonnull Map<String,String> systemProperties()
      Returns a map of system properties for the Maven execution. These include both Java system properties and Maven-specific system properties.
      Returns:
      an unmodifiable map of system properties
    • topDirectory

      @Nonnull Path topDirectory()
      Returns the top-level directory of the Maven invocation. This is typically the directory containing the POM file being executed.
      Returns:
      the top-level directory path
    • rootDirectory

      @Nonnull Optional<Path> rootDirectory()
      Returns the root directory of the Maven invocation, if found. This is determined by the presence of a .mvn directory or a POM with the root="true" property but is not always applicable (ie invocation from outside a checkout).
      Returns:
      the root directory path, if present
    • stdIn

      @Nonnull default Optional<InputStream> stdIn()
      Returns the input stream for the Maven execution, if running in embedded mode.
      Returns:
      an Optional containing the input stream, or empty if not applicable
    • stdOut

      @Nonnull default Optional<OutputStream> stdOut()
      Returns the output stream for the Maven execution, if running in embedded mode.
      Returns:
      an Optional containing the output stream, or empty if not applicable
    • stdErr

      @Nonnull default Optional<OutputStream> stdErr()
      Returns the error stream for the Maven execution, if running in embedded mode.
      Returns:
      an Optional containing the error stream, or empty if not applicable
    • coreExtensions

      @Nonnull Optional<List<CoreExtension>> coreExtensions()
      Returns a list of core extensions, if configured in the .mvn/extensions.xml file.
      Returns:
      an Optional containing the list of core extensions, or empty if not configured
    • options

      @Nonnull Options options()
      Returns the options associated with this invocation request.
      Returns:
      the options object