org.apache.maven.shared.invoker
Interface InvocationRequest

All Known Implementing Classes:
DefaultInvocationRequest

public interface InvocationRequest

Specifies the parameters used to control a Maven invocation.

Version:
$Id: InvocationRequest.java 807415 2009-08-24 22:32:16Z olamy $

Field Summary
static String CHECKSUM_POLICY_FAIL
          The strict checksum policy which fails the build if a corrupt artifact is detected.
static String CHECKSUM_POLICY_WARN
          The lax checksum policy which only outputs a warning if a corrupt artifact is detected.
static String REACTOR_FAIL_AT_END
          The failure mode "fail-at-end" where the build is only failed at its very end if necessary.
static String REACTOR_FAIL_FAST
          The failure mode "fail-fast" where the build is stopped by the first failure.
static String REACTOR_FAIL_NEVER
          The failure mode "fail-never" in which Maven will always exit with code 0 regardless of build failures.
 
Method Summary
 InvocationRequest activateReactor(String[] includes, String[] excludes)
          Dynamically constructs a reactor using the subdirectories of the current directory
 InvocationRequest addShellEnvironment(String name, String value)
          Adds the specified environment variable to the Maven invocation.
 String[] getActivatedReactorExcludes()
          Gets the list of subdirectory patterns to exclude from search
 String[] getActivatedReactorIncludes()
          Gets the list of subdirectory patterns to search
 File getBaseDirectory()
          Gets the path to the base directory of the POM for the Maven invocation.
 File getBaseDirectory(File defaultDirectory)
          Gets the path to the base directory of the POM for the Maven invocation.
 InvocationOutputHandler getErrorHandler(InvocationOutputHandler defaultHandler)
          Gets the handler used to capture the error output from the Maven build.
 String getFailureBehavior()
          Gets the failure mode of the Maven invocation.
 String getGlobalChecksumPolicy()
          Gets the checksum mode of the Maven invocation.
 List getGoals()
          Gets the goals for the Maven invocation.
 InputStream getInputStream(InputStream defaultStream)
          Gets the input stream used to provide input for the invoked Maven build.
 File getJavaHome()
          Gets the path to the base directory of the Java installation used to run Maven.
 File getLocalRepositoryDirectory(File defaultDirectory)
          Gets the path to the base directory of the local repository to use for the Maven invocation.
 String getMavenOpts()
          Gets the value of the MAVEN_OPTS environment variable.
 InvocationOutputHandler getOutputHandler(InvocationOutputHandler defaultHandler)
          Gets the handler used to capture the standard output from the Maven build.
 File getPomFile()
          Gets the path to the POM for the Maven invocation.
 String getPomFileName()
          Gets the (unqualified) filename of the POM for the Maven invocation.
 List getProfiles()
          Gets the profiles for the Maven invocation.
 Properties getProperties()
          Gets the system properties for the Maven invocation.
 Map getShellEnvironments()
          Gets the environment variables for the Maven invocation.
 File getUserSettingsFile()
          Gets the path to the user settings for the Maven invocation.
 boolean isActivatedReactor()
          Gets whether Maven should search subdirectories to build a dynamic reactor
 boolean isDebug()
          Gets the debug mode of the Maven invocation.
 boolean isInteractive()
          Gets the interaction mode of the Maven invocation.
 boolean isNonPluginUpdates()
          Indicates whether Maven should check for plugin updates.
 boolean isOffline()
          Gets the network mode of the Maven invocation.
 boolean isRecursive()
          Gets the recursion behavior of a reactor invocation.
 boolean isShellEnvironmentInherited()
          Indicates whether the environment variables of the current process should be propagated to the Maven invocation.
 boolean isShowErrors()
          Gets the exception output mode of the Maven invocation.
 boolean isShowVersion()
          The show version behaviour (-V option)
 boolean isUpdateSnapshots()
          Indicates whether Maven should enforce an update check for plugins and snapshots.
 InvocationRequest setBaseDirectory(File basedir)
          Sets the path to the base directory of the POM for the Maven invocation.
 InvocationRequest setDebug(boolean debug)
          Sets the debug mode of the Maven invocation.
 InvocationRequest setErrorHandler(InvocationOutputHandler errorHandler)
          Sets the handler used to capture the error output from the Maven build.
 InvocationRequest setFailureBehavior(String failureBehavior)
          Sets the failure mode of the Maven invocation.
 InvocationRequest setGlobalChecksumPolicy(String globalChecksumPolicy)
          Sets the checksum mode of the Maven invocation.
 InvocationRequest setGoals(List goals)
          Sets the goals for the Maven invocation.
 InvocationRequest setInputStream(InputStream inputStream)
          Sets the input stream used to provide input for the invoked Maven build.
 InvocationRequest setInteractive(boolean interactive)
          Sets the interaction mode of the Maven invocation.
 InvocationRequest setJavaHome(File javaHome)
          Sets the path to the base directory of the Java installation used to run Maven.
 InvocationRequest setLocalRepositoryDirectory(File localRepository)
          Sets the path to the base directory of the local repository to use for the Maven invocation.
 InvocationRequest setMavenOpts(String mavenOpts)
          Sets the value of the MAVEN_OPTS environment variable.
 InvocationRequest setNonPluginUpdates(boolean nonPluginUpdates)
          Specifies whether Maven should check for plugin updates.
 InvocationRequest setOffline(boolean offline)
          Sets the network mode of the Maven invocation.
 InvocationRequest setOutputHandler(InvocationOutputHandler outputHandler)
          Sets the handler used to capture the standard output from the Maven build.
 InvocationRequest setPomFile(File pomFile)
          Sets the path to the POM for the Maven invocation.
 InvocationRequest setPomFileName(String pomFilename)
          Sets the (unqualified) filename of the POM for the Maven invocation.
 InvocationRequest setProfiles(List profiles)
          Sets the profiles for the Maven invocation.
 InvocationRequest setProperties(Properties properties)
          Sets the system properties for the Maven invocation.
 InvocationRequest setRecursive(boolean recursive)
          Sets the recursion behavior of a reactor invocation.
 InvocationRequest setShellEnvironmentInherited(boolean shellEnvironmentInherited)
          Specifies whether the environment variables of the current process should be propagated to the Maven invocation.
 InvocationRequest setShowErrors(boolean showErrors)
          Sets the exception output mode of the Maven invocation.
 InvocationRequest setShowVersion(boolean showVersion)
          enable displaying version without stopping the build (-V cli option)
 InvocationRequest setUpdateSnapshots(boolean updateSnapshots)
          Specifies whether Maven should enforce an update check for plugins and snapshots.
 InvocationRequest setUserSettingsFile(File userSettings)
          Sets the path to the user settings for the Maven invocation.
 

Field Detail

REACTOR_FAIL_FAST

static final String REACTOR_FAIL_FAST
The failure mode "fail-fast" where the build is stopped by the first failure.

See Also:
Constant Field Values

REACTOR_FAIL_AT_END

static final String REACTOR_FAIL_AT_END
The failure mode "fail-at-end" where the build is only failed at its very end if necessary.

See Also:
Constant Field Values

REACTOR_FAIL_NEVER

static final String REACTOR_FAIL_NEVER
The failure mode "fail-never" in which Maven will always exit with code 0 regardless of build failures.

See Also:
Constant Field Values

CHECKSUM_POLICY_FAIL

static final String CHECKSUM_POLICY_FAIL
The strict checksum policy which fails the build if a corrupt artifact is detected.

See Also:
Constant Field Values

CHECKSUM_POLICY_WARN

static final String CHECKSUM_POLICY_WARN
The lax checksum policy which only outputs a warning if a corrupt artifact is detected.

See Also:
Constant Field Values
Method Detail

isInteractive

boolean isInteractive()
Gets the interaction mode of the Maven invocation. By default, Maven is executed in batch mode.

Returns:
true if Maven should be executed in interactive mode, false if the batch mode is used.

isOffline

boolean isOffline()
Gets the network mode of the Maven invocation. By default, Maven is executed in online mode.

Returns:
true if Maven should be executed in offline mode, false if the online mode is used.

isUpdateSnapshots

boolean isUpdateSnapshots()
Indicates whether Maven should enforce an update check for plugins and snapshots. By default, no update check is performed.

Returns:
true if plugins and snapshots should be updated, false otherwise.

isRecursive

boolean isRecursive()
Gets the recursion behavior of a reactor invocation. By default, Maven will recursive the build into sub modules.

Returns:
true if sub modules should be build, false otherwise.

isActivatedReactor

boolean isActivatedReactor()
Gets whether Maven should search subdirectories to build a dynamic reactor

Returns:
true if we should search subdirectories, false otherwise

getActivatedReactorIncludes

String[] getActivatedReactorIncludes()
Gets the list of subdirectory patterns to search

Returns:
list of subdirectory patterns to search, or null in which case defaults should be used

getActivatedReactorExcludes

String[] getActivatedReactorExcludes()
Gets the list of subdirectory patterns to exclude from search

Returns:
list of subdirectory patterns to exclude search, or null in which case nothing should be excluded

isDebug

boolean isDebug()
Gets the debug mode of the Maven invocation. By default, Maven is executed in normal mode.

Returns:
true if Maven should be executed in debug mode, false if the normal mode should be used.

isShowErrors

boolean isShowErrors()
Gets the exception output mode of the Maven invocation. By default, Maven will not print stack traces of build exceptions.

Returns:
true if Maven should print stack traces, false otherwise.

isShellEnvironmentInherited

boolean isShellEnvironmentInherited()
Indicates whether the environment variables of the current process should be propagated to the Maven invocation. By default, the current environment variables are inherited by the new Maven invocation.

Returns:
true if the environment variables should be propagated, false otherwise.

isNonPluginUpdates

boolean isNonPluginUpdates()
Indicates whether Maven should check for plugin updates. By default, plugin updates are not suppressed.

Returns:
true if plugin updates should be suppressed, false otherwise.

getFailureBehavior

String getFailureBehavior()
Gets the failure mode of the Maven invocation. By default, the mode REACTOR_FAIL_FAST is used.

Returns:
The failure mode, one of REACTOR_FAIL_FAST, REACTOR_FAIL_AT_END and REACTOR_FAIL_NEVER.

getLocalRepositoryDirectory

File getLocalRepositoryDirectory(File defaultDirectory)
Gets the path to the base directory of the local repository to use for the Maven invocation.

Parameters:
defaultDirectory - The default location to use if no location is configured for this request, may be null.
Returns:
The path to the base directory of the local repository or null to use the location from the settings.xml.

getInputStream

InputStream getInputStream(InputStream defaultStream)
Gets the input stream used to provide input for the invoked Maven build. This is in particular useful when invoking Maven in interactive mode.

Returns:
The input stream used to provide input for the invoked Maven build or null if not set.

getOutputHandler

InvocationOutputHandler getOutputHandler(InvocationOutputHandler defaultHandler)
Gets the handler used to capture the standard output from the Maven build.

Returns:
The output handler or null if not set.

getErrorHandler

InvocationOutputHandler getErrorHandler(InvocationOutputHandler defaultHandler)
Gets the handler used to capture the error output from the Maven build.

Returns:
The error handler or null if not set.

getPomFile

File getPomFile()
Gets the path to the POM for the Maven invocation. If no base directory is set, the parent directory of this POM will be used as the working directory for the Maven invocation.

Returns:
The path to the POM for the Maven invocation or null if not set.

getPomFileName

String getPomFileName()
Gets the (unqualified) filename of the POM for the Maven invocation. This setting is ignored if getPomFile() does not return null. Otherwise, the base directory is assumed to contain a POM with this name. By default, a file named pom.xml is used.

Returns:
The (unqualified) filename of the POM for the Maven invocation or null if not set.

getBaseDirectory

File getBaseDirectory()
Gets the path to the base directory of the POM for the Maven invocation. If getPomFile() does not return null, this setting only affects the working directory for the Maven invocation.

Returns:
The path to the base directory of the POM or null if not set.

getBaseDirectory

File getBaseDirectory(File defaultDirectory)
Gets the path to the base directory of the POM for the Maven invocation. If getPomFile() does not return null, this setting only affects the working directory for the Maven invocation.

Parameters:
defaultDirectory - The default base directory to use if none is configured for this request, may be null.
Returns:
The path to the base directory of the POM or null if not set.

getJavaHome

File getJavaHome()
Gets the path to the base directory of the Java installation used to run Maven.

Returns:
The path to the base directory of the Java installation used to run Maven or null to use the default Java home.

getProperties

Properties getProperties()
Gets the system properties for the Maven invocation.

Returns:
The system properties for the Maven invocation or null if not set.

getGoals

List getGoals()
Gets the goals for the Maven invocation.

Returns:
The goals for the Maven invocation or null if not set.

getUserSettingsFile

File getUserSettingsFile()
Gets the path to the user settings for the Maven invocation.

Returns:
The path to the user settings for the Maven invocation or null to load the user settings from the default location.

getGlobalChecksumPolicy

String getGlobalChecksumPolicy()
Gets the checksum mode of the Maven invocation.

Returns:
The checksum mode, one of CHECKSUM_POLICY_WARN and CHECKSUM_POLICY_FAIL.

getProfiles

List getProfiles()
Gets the profiles for the Maven invocation.

Returns:
The profiles for the Maven invocation or null if not set.

getShellEnvironments

Map getShellEnvironments()
Gets the environment variables for the Maven invocation.

Returns:
The environment variables for the Maven invocation or null if not set.

getMavenOpts

String getMavenOpts()
Gets the value of the MAVEN_OPTS environment variable.

Returns:
The value of the MAVEN_OPTS environment variable or null if not set.

isShowVersion

boolean isShowVersion()
The show version behaviour (-V option)

Returns:
The show version behaviour
Since:
2.0.11

setInteractive

InvocationRequest setInteractive(boolean interactive)
Sets the interaction mode of the Maven invocation.

Parameters:
interactive - true if Maven should be executed in interactive mode, false if the batch mode is used.
Returns:
This invocation request.

setOffline

InvocationRequest setOffline(boolean offline)
Sets the network mode of the Maven invocation.

Parameters:
offline - true if Maven should be executed in offline mode, false if the online mode is used.
Returns:
This invocation request.

setDebug

InvocationRequest setDebug(boolean debug)
Sets the debug mode of the Maven invocation.

Parameters:
debug - true if Maven should be executed in debug mode, false if the normal mode should be used.
Returns:
This invocation request.

setShowErrors

InvocationRequest setShowErrors(boolean showErrors)
Sets the exception output mode of the Maven invocation.

Parameters:
showErrors - true if Maven should print stack traces, false otherwise.
Returns:
This invocation request.

setUpdateSnapshots

InvocationRequest setUpdateSnapshots(boolean updateSnapshots)
Specifies whether Maven should enforce an update check for plugins and snapshots.

Parameters:
updateSnapshots - true if plugins and snapshots should be updated, false otherwise.
Returns:
This invocation request.

setFailureBehavior

InvocationRequest setFailureBehavior(String failureBehavior)
Sets the failure mode of the Maven invocation.

Parameters:
failureBehavior - The failure mode, must be one of REACTOR_FAIL_FAST, REACTOR_FAIL_AT_END and REACTOR_FAIL_NEVER.
Returns:
This invocation request.

activateReactor

InvocationRequest activateReactor(String[] includes,
                                  String[] excludes)
Dynamically constructs a reactor using the subdirectories of the current directory

Parameters:
includes - a list of filename patterns to include, or null, in which case the default is */pom.xml
excludes - a list of filename patterns to exclude, or null, in which case nothing is excluded
Returns:
This invocation request

setLocalRepositoryDirectory

InvocationRequest setLocalRepositoryDirectory(File localRepository)
Sets the path to the base directory of the local repository to use for the Maven invocation.

Parameters:
localRepository - The path to the base directory of the local repository, may be null.
Returns:
This invocation request.

setInputStream

InvocationRequest setInputStream(InputStream inputStream)
Sets the input stream used to provide input for the invoked Maven build. This is in particular useful when invoking Maven in interactive mode.

Parameters:
inputStream - The input stream used to provide input for the invoked Maven build, may be null if not required.
Returns:
This invocation request.

setOutputHandler

InvocationRequest setOutputHandler(InvocationOutputHandler outputHandler)
Sets the handler used to capture the standard output from the Maven build.

Parameters:
outputHandler - The output handler, may be null if the output is not of interest.
Returns:
This invocation request.

setErrorHandler

InvocationRequest setErrorHandler(InvocationOutputHandler errorHandler)
Sets the handler used to capture the error output from the Maven build.

Parameters:
errorHandler - The error handler, may be null if the output is not of interest.
Returns:
This invocation request.

setPomFile

InvocationRequest setPomFile(File pomFile)
Sets the path to the POM for the Maven invocation. If no base directory is set, the parent directory of this POM will be used as the working directory for the Maven invocation.

Parameters:
pomFile - The path to the POM for the Maven invocation, may be null if not used.
Returns:
This invocation request.

setPomFileName

InvocationRequest setPomFileName(String pomFilename)
Sets the (unqualified) filename of the POM for the Maven invocation. This setting is ignored if getPomFile() does not return null. Otherwise, the base directory is assumed to contain a POM with this name.

Parameters:
pomFilename - The (unqualified) filename of the POM for the Maven invocation, may be null if not used.
Returns:
This invocation request.

setBaseDirectory

InvocationRequest setBaseDirectory(File basedir)
Sets the path to the base directory of the POM for the Maven invocation. If getPomFile() does not return null, this setting only affects the working directory for the Maven invocation.

Parameters:
basedir - The path to the base directory of the POM, may be null if not used.
Returns:
This invocation request.

setJavaHome

InvocationRequest setJavaHome(File javaHome)
Sets the path to the base directory of the Java installation used to run Maven.

Parameters:
javaHome - The path to the base directory of the Java installation used to run Maven, may be null to use the default Java home.
Returns:
This invocation request.

setProperties

InvocationRequest setProperties(Properties properties)
Sets the system properties for the Maven invocation.

Parameters:
properties - The system properties for the Maven invocation, may be null if not set.
Returns:
This invocation request.

setGoals

InvocationRequest setGoals(List goals)
Sets the goals for the Maven invocation.

Parameters:
goals - The goals for the Maven invocation, may be null to execute the POMs default goal.
Returns:
This invocation request.

setProfiles

InvocationRequest setProfiles(List profiles)
Sets the profiles for the Maven invocation.

Parameters:
profiles - The profiles for the Maven invocation, may be null to use the default profiles.
Returns:
This invocation request.

setShellEnvironmentInherited

InvocationRequest setShellEnvironmentInherited(boolean shellEnvironmentInherited)
Specifies whether the environment variables of the current process should be propagated to the Maven invocation.

Parameters:
shellEnvironmentInherited - true if the environment variables should be propagated, false otherwise.
Returns:
This invocation request.

setUserSettingsFile

InvocationRequest setUserSettingsFile(File userSettings)
Sets the path to the user settings for the Maven invocation.

Parameters:
userSettings - The path to the user settings for the Maven invocation, may be null to load the user settings from the default location.
Returns:
This invocation request.

setGlobalChecksumPolicy

InvocationRequest setGlobalChecksumPolicy(String globalChecksumPolicy)
Sets the checksum mode of the Maven invocation.

Parameters:
globalChecksumPolicy - The checksum mode, must be one of CHECKSUM_POLICY_WARN and CHECKSUM_POLICY_FAIL.
Returns:
This invocation request.

setNonPluginUpdates

InvocationRequest setNonPluginUpdates(boolean nonPluginUpdates)
Specifies whether Maven should check for plugin updates.

Parameters:
nonPluginUpdates - true if plugin updates should be suppressed, false otherwise.
Returns:
This invocation request.

setRecursive

InvocationRequest setRecursive(boolean recursive)
Sets the recursion behavior of a reactor invocation.

Parameters:
recursive - true if sub modules should be build, false otherwise.
Returns:
This invocation request.

addShellEnvironment

InvocationRequest addShellEnvironment(String name,
                                      String value)
Adds the specified environment variable to the Maven invocation.

Parameters:
name - The name of the environment variable, must not be null.
value - The value of the environment variable, must not be null.
Returns:
This invocation request.

setMavenOpts

InvocationRequest setMavenOpts(String mavenOpts)
Sets the value of the MAVEN_OPTS environment variable.

Parameters:
mavenOpts - The value of the MAVEN_OPTS environment variable, may be null to use the default options.
Returns:
This invocation request.

setShowVersion

InvocationRequest setShowVersion(boolean showVersion)
enable displaying version without stopping the build (-V cli option)

Parameters:
showVersion - enable displaying version
Returns:
This invocation request.
Since:
2.0.11


Copyright © 2002-2009 The Apache Software Foundation. All Rights Reserved.