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
  • 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 MessageBuilderFactory messageBuilderFactory()
      Returns the factory for creating message builders.
      Returns:
      the message builder factory
    • args

      Returns the command-line arguments to be parsed.
      Returns:
      a list of argument strings
    • lookup

      @Nonnull Lookup lookup()
      Per-request Lookup for customization.
      Returns:
      a lookup possibly with custom components
    • 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
    • in

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

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

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

      @Nonnull static ParserRequest.Builder mvn(@Nonnull String[] args, @Nonnull Logger logger, @Nonnull MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven ParserRequest.
      Parameters:
      args - the command-line arguments
      logger - the logger to be used during parsing
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvn

      @Nonnull static ParserRequest.Builder mvn(@Nonnull List<String> args, @Nonnull Logger logger, @Nonnull MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven ParserRequest.
      Parameters:
      args - the command-line arguments
      logger - the logger to be used during parsing
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnenc

      @Nonnull static ParserRequest.Builder mvnenc(@Nonnull String[] args, @Nonnull Logger logger, @Nonnull MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      logger - the logger to be used during parsing
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance
    • mvnenc

      @Nonnull static ParserRequest.Builder mvnenc(@Nonnull List<String> args, @Nonnull Logger logger, @Nonnull MessageBuilderFactory messageBuilderFactory)
      Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.
      Parameters:
      args - the command-line arguments
      logger - the logger to be used during parsing
      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 Logger logger, @Nonnull 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
      logger - the logger to be used during parsing
      messageBuilderFactory - the factory for creating message builders
      Returns:
      a new Builder instance