Package org.apache.maven.shared.invoker
Class DefaultInvoker
java.lang.Object
org.apache.maven.shared.invoker.DefaultInvoker
- All Implemented Interfaces:
Invoker
Class intended to be used by clients who wish to invoke a forked Maven process from their applications
- Author:
- jdcasey
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(InvocationRequest request) Executes Maven using the parameters specified by the given invocation request.Getter for the fieldlocalRepositoryDirectory
.Getter for the fieldlogger
.Getter for the fieldmavenExecutable
.Getter for the fieldmavenHome
.Getter for the fieldworkingDirectory
.setErrorHandler
(InvocationOutputHandler errorHandler) Sets the handler used to capture the error output from the Maven build.setInputStream
(InputStream inputStream) Sets the input stream used to provide input for the invoked Maven build.setLocalRepositoryDirectory
(File localRepositoryDirectory) Sets the path to the base directory of the local repository to use for the Maven invocation.setLogger
(InvokerLogger logger) Sets the logger used by this invoker to output diagnostic messages.setMavenExecutable
(File mavenExecutable) mavenExecutable
can either be a file relative to ${maven.home}/bin/ or an absolute file.setMavenHome
(File mavenHome) Sets the path to the base directory of the Maven installation used to invoke Maven.setOutputHandler
(InvocationOutputHandler outputHandler) Sets the handler used to capture the standard output from the Maven build.setWorkingDirectory
(File workingDirectory) Sets the working directory for the Maven invocation.
-
Field Details
-
ROLE_HINT
ConstantROLE_HINT="default"
- See Also:
-
-
Constructor Details
-
DefaultInvoker
public DefaultInvoker()
-
-
Method Details
-
getLocalRepositoryDirectory
Getter for the field
localRepositoryDirectory
.- Specified by:
getLocalRepositoryDirectory
in interfaceInvoker
- Returns:
- a
File
object.
-
getLogger
Getter for the field
logger
.- Specified by:
getLogger
in interfaceInvoker
- Returns:
- a
InvokerLogger
object.
-
setLocalRepositoryDirectory
Sets the path to the base directory of the local repository to use for the Maven invocation.- Specified by:
setLocalRepositoryDirectory
in interfaceInvoker
- Parameters:
localRepositoryDirectory
- The path to the base directory of the local repository ornull
to use the location from thesettings.xml
.- Returns:
- This invoker instance.
-
getWorkingDirectory
Getter for the field
workingDirectory
.- Specified by:
getWorkingDirectory
in interfaceInvoker
- Returns:
- a
File
object.
-
setWorkingDirectory
Sets the working directory for the Maven invocation.- Specified by:
setWorkingDirectory
in interfaceInvoker
- Parameters:
workingDirectory
- The working directory for the Maven invocation, may benull
to derive the working directory from the base directory of the processed POM.- Returns:
- This invoker instance.
-
getMavenHome
Getter for the field
mavenHome
.- Specified by:
getMavenHome
in interfaceInvoker
- Returns:
- a
File
object.
-
setMavenHome
Sets the path to the base directory of the Maven installation used to invoke Maven. This parameter may be left unspecified to use the default Maven installation which will be discovered by evaluating the system propertymaven.home
.- Specified by:
setMavenHome
in interfaceInvoker
- Parameters:
mavenHome
- The path to the base directory of the Maven installation, may benull
to use the default Maven installation.- Returns:
- This invoker instance.
-
getMavenExecutable
Getter for the field
mavenExecutable
.- Specified by:
getMavenExecutable
in interfaceInvoker
- Returns:
- a
File
object.
-
setMavenExecutable
mavenExecutable
can either be a file relative to ${maven.home}/bin/ or an absolute file.- Specified by:
setMavenExecutable
in interfaceInvoker
- Parameters:
mavenExecutable
- the executable- Returns:
- This invoker instance
-
setInputStream
Sets the input stream used to provide input for the invoked Maven build. This is in particular useful when invoking Maven in interactive mode.- Specified by:
setInputStream
in interfaceInvoker
- Parameters:
inputStream
- The input stream used to provide input for the invoked Maven build, may benull
if not required.- Returns:
- This invoker instance.