Interface ParserRequest


@Immutable @Experimental public interface ParserRequest
Represents a request to parse Maven command-line arguments. This interface encapsulates all the necessary information needed to parse Maven commands and arguments into an InvokerRequest.
Since:
4.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the command-line arguments to be parsed.
    builder(String command, String commandName, List<String> args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a ParserRequest.
    Returns the Maven command to be executed.
    Returns the Maven command name (ie "Maven").
    cwd()
    Returns the current working directory for the Maven execution.
    boolean
    Returns true if this call happens in "embedded" mode, for example by another application that embeds Maven.
    Returns the logger to be used during the parsing process.
    org.apache.maven.api.services.Lookup
    Per-request Lookup for customization.
    Returns the Maven home directory.
    org.apache.maven.api.services.MessageBuilderFactory
    Returns the factory for creating message builders.
    mvn(String[] args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven ParserRequest.
    mvn(List<String> args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven ParserRequest.
    mvnenc(String[] args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
    mvnenc(List<String> args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
    mvnsh(String[] args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Shell Tool ParserRequest.
    mvnsh(List<String> args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Shell Tool ParserRequest.
    mvnup(String[] args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Upgrade Tool ParserRequest.
    mvnup(List<String> args, org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
    Creates a new Builder instance for constructing a Maven Upgrade Tool ParserRequest.
    Returns the error stream to be used for the Maven execution.
    Returns the input stream to be used for the Maven execution.
    Returns the output stream to be used for the Maven execution.
    Returns the user's home directory.
  • Method Details

    • command

      @Nonnull String command()
      Returns the Maven command to be executed. This command is used in some invokers (ie forked) but also to present help to user.
      Returns:
      the command string
    • commandName

      @Nonnull String commandName()
      Returns the Maven command name (ie "Maven"). This string is used in some invokers to complete error messages.
      Returns:
      the command (human) name
    • logger

      @Nonnull Logger logger()
      Returns the logger to be used during the parsing process.
      Returns:
      the logger instance
    • messageBuilderFactory

      @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory()
      Returns the factory for creating message builders.
      Returns:
      the message builder factory
    • args

      @Nonnull List<String> args()
      Returns the command-line arguments to be parsed.
      Returns:
      a list of argument strings
    • lookup

      @Nonnull org.apache.maven.api.services.Lookup lookup()
      Per-request Lookup for customization.
      Returns:
      a lookup possibly with custom components
    • cwd

      @Nullable Path cwd()
      Returns the current working directory for the Maven execution. If not explicitly set, this value will be detected during parsing.
      Returns:
      the current working directory path, or null if not set
    • mavenHome

      @Nullable Path mavenHome()
      Returns the Maven home directory. If not explicitly set, this value will be detected during parsing.
      Returns:
      the Maven home directory path, or null if not set
    • userHome

      @Nullable Path userHome()
      Returns the user's home directory. If not explicitly set, this value will be detected during parsing.
      Returns:
      the user's home directory path, or null if not set
    • stdIn

      @Nullable InputStream stdIn()
      Returns the input stream to be used for the Maven execution. If not set, System.in will be used by default.
      Returns:
      the input stream, or null if not set
    • stdOut

      @Nullable OutputStream stdOut()
      Returns the output stream to be used for the Maven execution. If not set, System.out will be used by default.
      Returns:
      the output stream, or null if not set
    • stdErr

      @Nullable OutputStream stdErr()
      Returns the error stream to be used for the Maven execution. If not set, System.err will be used by default.
      Returns:
      the error stream, or null if not set
    • embedded

      boolean embedded()
      Returns true if this call happens in "embedded" mode, for example by another application that embeds Maven. When running in "embedded" mode, Maven will not try to grab system terminal and will use provided stdIn() or InputStream.nullInputStream() as standard in stream.
    • mvn

      @Nonnull static ParserRequest.Builder mvn(@Nonnull String[] args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvn

      @Nonnull static ParserRequest.Builder mvn(@Nonnull List<String> args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnenc

      @Nonnull static ParserRequest.Builder mvnenc(@Nonnull String[] args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnenc

      @Nonnull static ParserRequest.Builder mvnenc(@Nonnull List<String> args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnsh

      @Nonnull static ParserRequest.Builder mvnsh(@Nonnull String[] args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Shell Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnsh

      @Nonnull static ParserRequest.Builder mvnsh(@Nonnull List<String> args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Shell Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnup

      @Nonnull static ParserRequest.Builder mvnup(@Nonnull String[] args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Upgrade Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnup

      @Nonnull static ParserRequest.Builder mvnup(@Nonnull List<String> args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Upgrade Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • builder

      @Nonnull static ParserRequest.Builder builder(@Nonnull String command, @Nonnull String commandName, @Nonnull List<String> args, @Nonnull org.apache.maven.api.services.MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a ParserRequest.
      Parameters:
      command - the Maven command to be executed
      commandName - the Maven command Name to be executed
      args - the command-line arguments
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance