Package org.apache.maven.enforcer.rules
Class RequireJavaVendor
java.lang.Object
org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
org.apache.maven.enforcer.rules.RequireJavaVendor
- All Implemented Interfaces:
EnforcerRuleBase
@Named("requireJavaVendor")
public final class RequireJavaVendor
extends AbstractStandardEnforcerRule
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
- Author:
- Tim Sijstermans
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This is the interface into the rule.The Java Vendor not changed during one Maven session, so can be cached.getLog()Provide anEnforcerLoggerinstance for RulevoidsetExcludes(List<String> theExcludes) Specify the banned vendors.voidsetIncludes(List<String> theIncludes) Specify the allowed vendor names.voidsetLog(EnforcerLogger log) Used byEnforcerMojoto inject logger instancetoString()Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getLevel
-
Constructor Details
-
RequireJavaVendor
public RequireJavaVendor()
-
-
Method Details
-
getCacheId
The Java Vendor not changed during one Maven session, so can be cached.- Overrides:
getCacheIdin classAbstractEnforcerRule- Returns:
- a cache id
-
execute
Description copied from class:AbstractEnforcerRuleThis 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 and rule level if it should stop or just log the message as a warning.- Specified by:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exception
-
setExcludes
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
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:AdoptOpenJDKprohibits vendor name AdoptOpenJDKAmazonprohibits vendor name Amazon
- Parameters:
theIncludes- the list of required vendors.- See Also:
-
toString
-
setLog
Used byEnforcerMojoto inject logger instance- Specified by:
setLogin interfaceEnforcerRuleBase- Parameters:
log- anEnforcerLoggerinstance
-
getLog
Provide anEnforcerLoggerinstance for RuleNOTICE A logger is not available in constructors.
- Returns:
- an
EnforcerLoggerinstance
-