Class InvokerProperties
java.lang.Object
org.apache.maven.plugins.invoker.InvokerProperties
Provides a convenient facade around the
invoker.properties.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate static enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInvokerProperties(Properties properties) Creates a new facade for the specified invoker properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureInvocation(org.apache.maven.shared.invoker.InvocationRequest request, int index) Configures the specified invocation request from these invoker properties.Gets a value from the invoker properties.get(InvokerProperties.InvocationProperty prop, int index) getEnvironmentVariables(int index) Extract environment variable from properties for given index.Gets the description of the corresponding build job.Gets the name of the corresponding build job.Gets the specification of JRE versions on which this build job should be run.getJreVersion(int index) Gets the specification of JRE versions on which this build job should be run.Gets the specification of Maven versions on which this build job should be run.getMavenVersion(int index) intGet the corresponding ordinal valueGets the specification of OS families on which this build job should be run.getOsFamily(int index) Gets the specification of OS families on which this build job should be run.Gets the invoker properties being wrapped.getSettingsFile(int index) Gets the settings file used for the specified invocation.getToolchains(int index) private Collection<InvokerToolchain> getUserPropertiesFile(int index) Gets the path to the properties file used to set the user properties for the specified invocation.booleanisExpectedResult(int exitCode, int index) Checks whether the specified exit code matches the one expected for the given invocation.booleanisInvocationDefined(int index) Determines whether these invoker properties contain a build definition for the specified invocation index.booleanisSelectorDefined(int index) Determines whether these invoker properties contain a build definition for the specified selector index.voidsetDefaultDebug(boolean defaultDebug) Default value for debugvoidsetDefaultEnvironmentVariables(Map<String, String> defaultEnvironmentVariables) Default value for environmentVariablesvoidsetDefaultGoals(List<String> defaultGoals) Default value for goalsvoidsetDefaultMavenExecutable(String defaultMavenExecutable) Default value for mavenExecutablevoidsetDefaultMavenOpts(String defaultMavenOpts) Default value for mavenOptsvoidsetDefaultProfiles(List<String> defaultProfiles) Default value for profilesvoidsetDefaultQuiet(boolean defaultQuiet) Default value for quietvoidsetDefaultTimeoutInSeconds(int defaultTimeoutInSeconds) Default value for timeoutInSecondsvoidsetDefaultUpdateSnapshots(boolean defaultUpdateSnapshots) Default value for updateSnapshotsvoidsetDefaultUserPropertiesFiles(String defaultUserPropertiesFiles) Default value for userPropertiesFileprivate <T> voidsetIfNotNull(Consumer<T> consumer, T value)
-
Field Details
-
logger
private final org.slf4j.Logger logger -
SELECTOR_PREFIX
- See Also:
-
ENVIRONMENT_VARIABLES_PATTERN
-
defaultDebug
-
defaultQuiet
-
defaultGoals
-
defaultProfiles
-
defaultMavenOpts
-
defaultTimeoutInSeconds
-
defaultEnvironmentVariables
-
defaultMavenExecutable
-
defaultUpdateSnapshots
-
defaultUserPropertiesFiles
-
properties
The invoker properties being wrapped.
-
-
Constructor Details
-
InvokerProperties
InvokerProperties(Properties properties) Creates a new facade for the specified invoker properties. The properties will not be copied, so any changes to them will be reflected by the facade.- Parameters:
properties- The invoker properties to wrap, may benullif none.
-
-
Method Details
-
setDefaultDebug
public void setDefaultDebug(boolean defaultDebug) Default value for debug- Parameters:
defaultDebug- a default value
-
setDefaultQuiet
public void setDefaultQuiet(boolean defaultQuiet) Default value for quiet- Parameters:
defaultQuiet- a default value
-
setDefaultGoals
-
setDefaultProfiles
-
setDefaultMavenExecutable
Default value for mavenExecutable- Parameters:
defaultMavenExecutable- a default value
-
setDefaultMavenOpts
Default value for mavenOpts- Parameters:
defaultMavenOpts- a default value
-
setDefaultTimeoutInSeconds
public void setDefaultTimeoutInSeconds(int defaultTimeoutInSeconds) Default value for timeoutInSeconds- Parameters:
defaultTimeoutInSeconds- a default value
-
setDefaultEnvironmentVariables
-
setDefaultUpdateSnapshots
public void setDefaultUpdateSnapshots(boolean defaultUpdateSnapshots) Default value for updateSnapshots- Parameters:
defaultUpdateSnapshots- a default value
-
setDefaultUserPropertiesFiles
Default value for userPropertiesFile- Parameters:
defaultUserPropertiesFiles- a default value
-
getProperties
Gets the invoker properties being wrapped.- Returns:
- The invoker properties being wrapped, never
null.
-
getJobName
Gets the name of the corresponding build job.- Returns:
- The name of the build job or an empty string if not set.
-
getJobDescription
Gets the description of the corresponding build job.- Returns:
- The description of the build job or an empty string if not set.
-
getOrdinal
public int getOrdinal()Get the corresponding ordinal value- Returns:
- The ordinal value
-
getJreVersion
Gets the specification of JRE versions on which this build job should be run.- Returns:
- The specification of JRE versions or an empty string if not set.
-
getJreVersion
Gets the specification of JRE versions on which this build job should be run.- Returns:
- The specification of JRE versions or an empty string if not set.
-
getMavenVersion
Gets the specification of Maven versions on which this build job should be run.- Returns:
- The specification of Maven versions on which this build job should be run.
- Since:
- 1.5
-
getMavenVersion
- Parameters:
index- the selector index- Returns:
- The specification of Maven versions on which this build job should be run.
- Since:
- 3.0.0
-
getOsFamily
Gets the specification of OS families on which this build job should be run.- Returns:
- The specification of OS families or an empty string if not set.
-
getOsFamily
Gets the specification of OS families on which this build job should be run.- Parameters:
index- the selector index- Returns:
- The specification of OS families or an empty string if not set.
- Since:
- 3.0.0
-
getToolchains
-
getToolchains
-
getToolchains
-
getEnvironmentVariables
-
isInvocationDefined
public boolean isInvocationDefined(int index) Determines whether these invoker properties contain a build definition for the specified invocation index.- Parameters:
index- The one-based index of the invocation to check for, must not be negative.- Returns:
trueif the invocation with the specified index is defined,falseotherwise.
-
isSelectorDefined
public boolean isSelectorDefined(int index) Determines whether these invoker properties contain a build definition for the specified selector index.- Parameters:
index- the index- Returns:
trueif the selector with the specified index is defined,falseotherwise.- Since:
- 3.0.0
-
setIfNotNull
-
isExpectedResult
public boolean isExpectedResult(int exitCode, int index) Checks whether the specified exit code matches the one expected for the given invocation.- Parameters:
exitCode- The exit code of the Maven invocation to check.index- The index of the invocation for which to check the exit code, must not be negative.- Returns:
trueif the exit code is zero and a success was expected or if the exit code is non-zero and a failue was expected,falseotherwise.
-
getUserPropertiesFile
Gets the path to the properties file used to set the user properties for the specified invocation.- Parameters:
index- The index of the invocation, must not be negative.- Returns:
- The path to the properties file or
nullif not set.
-
getSettingsFile
Gets the settings file used for the specified invocation.- Parameters:
index- The index of the invocation, must not be negative.- Returns:
- the value for the settings file or
nullif not set.
-
get
Gets a value from the invoker properties. The invoker properties are intended to describe the invocation settings for multiple builds of the same project. For this reason, the properties are indexed. First, a property namedkey.indexwill be queried. If this property does not exist, the value of the property namedkeywill finally be returned.- Parameters:
key- The (base) key for the invoker property to lookup, must not benull.index- The index of the invocation for which to retrieve the value, must not be negative.- Returns:
- The value for the requested invoker property or
nullif not defined.
-
get
-