Package org.apache.maven.api.cli
Interface Parser<R extends InvokerRequest<? extends Options>>
- Type Parameters:
R- the type ofInvokerRequestproduced by this parser, extendingInvokerRequest
- All Known Subinterfaces:
EncryptParser,ForkedMavenParser,MavenParser<R>
- All Known Implementing Classes:
BaseMavenParser,BaseParser,DefaultEncryptParser,DefaultForkedMavenParser,DefaultMavenParser
Defines the contract for parsing Maven command-line arguments and creating an InvokerRequest.
This interface is responsible for interpreting the command-line input and constructing
the appropriate
InvokerRequest object.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault Rmvn(String[] args, Logger logger, MessageBuilderFactory messageBuilderFactory) Parses the given Maven arguments to create an InvokerRequest.parse(ParserRequest parserRequest) Parses the given ParserRequest to create an InvokerRequest.
-
Method Details
-
mvn
@Nonnull default R mvn(@Nonnull String[] args, @Nonnull Logger logger, @Nonnull MessageBuilderFactory messageBuilderFactory) throws ParserException, IOException Parses the given Maven arguments to create an InvokerRequest. This is a convenience method that internally creates a ParserRequest usingParserRequest.mvn(String[], Logger, MessageBuilderFactory).- Parameters:
args- the command-line argumentslogger- the logger to use during parsingmessageBuilderFactory- the factory for creating message builders- Returns:
- the parsed InvokerRequest
- Throws:
ParserException- if there's an error during parsing of the command or argumentsIOException- if there's an I/O error during the parsing process
-
parse
Parses the given ParserRequest to create an InvokerRequest. This method is responsible for interpreting the contents of the ParserRequest and constructing the appropriate InvokerRequest object.- Parameters:
parserRequest- the request containing all necessary information for parsing- Returns:
- the parsed InvokerRequest
- Throws:
ParserException- if there's an error during parsing of the requestIOException- if there's an I/O error during the parsing process
-