@Component(role=Invoker.class, hint="default") public class DefaultInvoker extends java.lang.Object implements Invoker
| Modifier and Type | Field and Description |
|---|---|
private static InvokerLogger |
DEFAULT_LOGGER |
private static InvocationOutputHandler |
DEFAULT_OUTPUT_HANDLER |
private InvocationOutputHandler |
errorHandler |
private java.io.InputStream |
inputStream |
private java.io.File |
localRepositoryDirectory |
private InvokerLogger |
logger |
private java.io.File |
mavenExecutable |
private java.io.File |
mavenHome |
private InvocationOutputHandler |
outputHandler |
static java.lang.String |
ROLE_HINT |
private java.io.File |
workingDirectory |
| Constructor and Description |
|---|
DefaultInvoker() |
| Modifier and Type | Method and Description |
|---|---|
InvocationResult |
execute(InvocationRequest request)
Executes Maven using the parameters specified by the given invocation request.
|
private int |
executeCommandLine(org.codehaus.plexus.util.cli.Commandline cli,
InvocationRequest request) |
java.io.File |
getLocalRepositoryDirectory()
Gets the path to the base directory of the local repository to use for the Maven invocation.
|
InvokerLogger |
getLogger()
Gets the logger used by this invoker to output diagnostic messages.
|
java.io.File |
getMavenExecutable()
Get the customized File of the Maven executable.
|
java.io.File |
getMavenHome()
Gets the path to the base directory of the Maven installation used to invoke Maven.
|
java.io.File |
getWorkingDirectory()
Gets the working directory for the Maven invocation.
|
Invoker |
setErrorHandler(InvocationOutputHandler errorHandler)
Sets the handler used to capture the error output from the Maven build.
|
Invoker |
setInputStream(java.io.InputStream inputStream)
Sets the input stream used to provide input for the invoked Maven build.
|
Invoker |
setLocalRepositoryDirectory(java.io.File localRepositoryDirectory)
Sets the path to the base directory of the local repository to use for the Maven invocation.
|
Invoker |
setLogger(InvokerLogger logger)
Sets the logger used by this invoker to output diagnostic messages.
|
Invoker |
setMavenExecutable(java.io.File mavenExecutable)
mavenExecutable can either be a file relative to ${maven.home}/bin/ or an absolute file. |
Invoker |
setMavenHome(java.io.File mavenHome)
Sets the path to the base directory of the Maven installation used to invoke Maven.
|
Invoker |
setOutputHandler(InvocationOutputHandler outputHandler)
Sets the handler used to capture the standard output from the Maven build.
|
Invoker |
setWorkingDirectory(java.io.File workingDirectory)
Sets the working directory for the Maven invocation.
|
public static final java.lang.String ROLE_HINT
private static final InvokerLogger DEFAULT_LOGGER
private static final InvocationOutputHandler DEFAULT_OUTPUT_HANDLER
private java.io.File localRepositoryDirectory
private InvokerLogger logger
private java.io.File workingDirectory
private java.io.File mavenHome
private java.io.File mavenExecutable
private InvocationOutputHandler outputHandler
private java.io.InputStream inputStream
private InvocationOutputHandler errorHandler
public InvocationResult execute(InvocationRequest request) throws MavenInvocationException
Invokerexecute in interface Invokerrequest - The invocation request to execute, must not be null.null.MavenInvocationExceptionprivate int executeCommandLine(org.codehaus.plexus.util.cli.Commandline cli,
InvocationRequest request)
throws org.codehaus.plexus.util.cli.CommandLineException
org.codehaus.plexus.util.cli.CommandLineExceptionpublic java.io.File getLocalRepositoryDirectory()
InvokergetLocalRepositoryDirectory in interface Invokernull to use the location from
the settings.xml.public InvokerLogger getLogger()
Invokerpublic Invoker setLocalRepositoryDirectory(java.io.File localRepositoryDirectory)
InvokersetLocalRepositoryDirectory in interface InvokerlocalRepositoryDirectory - The path to the base directory of the local repository or null to
use the location from the settings.xml.public Invoker setLogger(InvokerLogger logger)
Invokerpublic java.io.File getWorkingDirectory()
InvokergetWorkingDirectory in interface Invokernull if the working directory is derived
from the base directory of the processed POM.public Invoker setWorkingDirectory(java.io.File workingDirectory)
InvokersetWorkingDirectory in interface InvokerworkingDirectory - The working directory for the Maven invocation, may be null to derive the
working directory from the base directory of the processed POM.public java.io.File getMavenHome()
InvokergetMavenHome in interface Invokernull if using the default
Maven installation.public Invoker setMavenHome(java.io.File mavenHome)
Invokermaven.home and the environment variable M2_HOME.setMavenHome in interface InvokermavenHome - The path to the base directory of the Maven installation, may be null to use the
default Maven installation.public java.io.File getMavenExecutable()
InvokergetMavenExecutable in interface Invokernullpublic Invoker setMavenExecutable(java.io.File mavenExecutable)
InvokermavenExecutable can either be a file relative to ${maven.home}/bin/ or an absolute file.setMavenExecutable in interface InvokermavenExecutable - the executablepublic Invoker setErrorHandler(InvocationOutputHandler errorHandler)
InvokersetErrorHandler in interface InvokererrorHandler - The error handler, may be null if the output is not of interest.public Invoker setInputStream(java.io.InputStream inputStream)
InvokersetInputStream in interface InvokerinputStream - The input stream used to provide input for the invoked Maven build, may be null
if not required.public Invoker setOutputHandler(InvocationOutputHandler outputHandler)
InvokersetOutputHandler in interface InvokeroutputHandler - The output handler, may be null if the output is not of interest.