Class RequireEnvironmentVariable
java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
org.apache.maven.plugins.enforcer.AbstractPropertyEnforcerRule
org.apache.maven.plugins.enforcer.RequireEnvironmentVariable
- All Implemented Interfaces:
EnforcerRule
,EnforcerRule2
This rule checks that certain environment variable is set.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIf the rule is to be cached, this id is used as part of the key.getName()
How the property that is being evaluated is calledThe name of the property currently being evaluated, this is used for default message pourpouses onlyfinal String
boolean
This method tells the enforcer if the rule results may be cached.boolean
isResultValid
(EnforcerRule cachedRule) Checks if cached result is valid.resolveValue
(EnforcerRuleHelper helper) Resolves the property valuefinal void
setVariableName
(String variableName) Methods inherited from class org.apache.maven.plugins.enforcer.AbstractPropertyEnforcerRule
execute, getRegex, getRegexMessage, setRegex, setRegexMessage
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
Field Details
-
variableName
Specify the required variable.
-
-
Constructor Details
-
RequireEnvironmentVariable
public RequireEnvironmentVariable()
-
-
Method Details
-
setVariableName
- Parameters:
variableName
- the variable name- See Also:
-
getVariableName
-
resolveValue
Description copied from class:AbstractPropertyEnforcerRule
Resolves the property value- Specified by:
resolveValue
in classAbstractPropertyEnforcerRule
-
isCacheable
public boolean isCacheable()Description copied from interface:EnforcerRule
This method tells the enforcer if the rule results may be cached. If the result is true, the results will be remembered for future executions in the same build (ie children). Subsequent iterations of the rule will be queried to see if they are also cacheable. This will allow the rule to be uncached further down the tree if needed.- Specified by:
isCacheable
in interfaceEnforcerRule
- Overrides:
isCacheable
in classAbstractNonCacheableEnforcerRule
- Returns:
true
if rule is cacheable
-
isResultValid
Description copied from interface:EnforcerRule
Checks if cached result is valid.- Specified by:
isResultValid
in interfaceEnforcerRule
- Overrides:
isResultValid
in classAbstractNonCacheableEnforcerRule
- Parameters:
cachedRule
- the last cached instance of the rule. This is to be used by the rule to potentially determine if the results are still valid (ie if the configuration has been overridden)- Returns:
true
if the stored results are valid for the same id.
-
getCacheId
Description copied from interface:EnforcerRule
If the rule is to be cached, this id is used as part of the key. This can allow rules to take parameters that allow multiple results of the same rule to be cached.- Specified by:
getCacheId
in interfaceEnforcerRule
- Overrides:
getCacheId
in classAbstractNonCacheableEnforcerRule
- Returns:
- id to be used by the enforcer to determine uniqueness of cache results. The ids only need to be unique within a given rule implementation as the full key will be [classname]-[id]
-
getPropertyName
Description copied from class:AbstractPropertyEnforcerRule
The name of the property currently being evaluated, this is used for default message pourpouses only- Specified by:
getPropertyName
in classAbstractPropertyEnforcerRule
-
getName
Description copied from class:AbstractPropertyEnforcerRule
How the property that is being evaluated is called- Specified by:
getName
in classAbstractPropertyEnforcerRule
-