Class RequireJavaVendor
- java.lang.Object
-
- org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
-
- org.apache.maven.plugins.enforcer.RequireJavaVendor
-
- All Implemented Interfaces:
EnforcerRule
,EnforcerRule2
public class RequireJavaVendor extends AbstractNonCacheableEnforcerRule
This rule checks that the Java vendor is allowed. Rule will fail is it matches any of the excludes or doesn't match any include in case it was set.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description RequireJavaVendor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(EnforcerRuleHelper helper)
This is the interface into the rule.void
setExcludes(java.util.List<java.lang.String> theExcludes)
Specify the banned vendors.void
setIncludes(java.util.List<java.lang.String> theIncludes)
Specify the allowed vendor names.-
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValid
-
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
-
-
-
Method Detail
-
execute
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
Description copied from interface:EnforcerRule
This is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag if it should stop or just log the message as a warning.- Parameters:
helper
- The helper provides access to the log, MavenSession and has helpers to get common components. It is also able to lookup components by class name.- Throws:
EnforcerRuleException
- the enforcer rule exception
-
setExcludes
public void setExcludes(java.util.List<java.lang.String> theExcludes)
Specify the banned vendors. This should be an exact match of the System Property java.vendor, which you can also see with mvn --version.
Excludes override the include rules.- Parameters:
theExcludes
- the vendor to to exclude from the include list.
-
setIncludes
public void setIncludes(java.util.List<java.lang.String> theIncludes)
Specify the allowed vendor names. This should be an exact match of the System Property java.vendor, which you can also see with mvn --version.
The rule will fail if vendor name matches any exclude, unless it also matches an include rule. Some examples are:AdoptOpenJDK
prohibits vendor name AdoptOpenJDKAmazon
prohibits vendor name Amazon
- Parameters:
theIncludes
- the list of required vendors.- See Also:
setExcludes(List)
-
-