Package org.apache.maven.api.cli
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
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionargs()
Returns the command-line arguments to be parsed.static ParserRequest.Builder
builder
(String command, String commandName, List<String> args, Logger logger, MessageBuilderFactory messageBuilderFactory) Creates a new Builder instance for constructing a ParserRequest.command()
Returns the Maven command to be executed.Returns the Maven command name (ie "Maven").cwd()
Returns the current working directory for the Maven execution.err()
Returns the error stream to be used for the Maven execution.in()
Returns the input stream to be used for the Maven execution.logger()
Returns the logger to be used during the parsing process.lookup()
Per-requestLookup
for customization.Returns the Maven home directory.Returns the factory for creating message builders.static ParserRequest.Builder
mvn
(String[] args, Logger logger, MessageBuilderFactory messageBuilderFactory) Creates a new Builder instance for constructing a Maven ParserRequest.static ParserRequest.Builder
mvn
(List<String> args, Logger logger, MessageBuilderFactory messageBuilderFactory) Creates a new Builder instance for constructing a Maven ParserRequest.static ParserRequest.Builder
mvnenc
(String[] args, Logger logger, MessageBuilderFactory messageBuilderFactory) Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.static ParserRequest.Builder
mvnenc
(List<String> args, Logger logger, MessageBuilderFactory messageBuilderFactory) Creates a new Builder instance for constructing a Maven Encrypting Tool ParserRequest.out()
Returns the output stream to be used for the Maven execution.userHome()
Returns the user's home directory.
-
Field Details
-
MVN_CMD
- See Also:
-
MVN_NAME
- See Also:
-
MVNENC_CMD
- See Also:
-
MVNENC_NAME
- See Also:
-
-
Method Details
-
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
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
Returns the logger to be used during the parsing process.- Returns:
- the logger instance
-
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
Per-requestLookup
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
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
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 argumentslogger
- the logger to be used during parsingmessageBuilderFactory
- 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 argumentslogger
- the logger to be used during parsingmessageBuilderFactory
- 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 argumentslogger
- the logger to be used during parsingmessageBuilderFactory
- 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 argumentslogger
- the logger to be used during parsingmessageBuilderFactory
- 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 executedcommandName
- the Maven command Name to be executedargs
- the command-line argumentslogger
- the logger to be used during parsingmessageBuilderFactory
- the factory for creating message builders- Returns:
- a new Builder instance
-