Package org.apache.maven.enforcer.rules
Class RequireJavaVendor
- java.lang.Object
-
- org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
-
- 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
-
-
Constructor Summary
Constructors Constructor Description RequireJavaVendor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
This is the interface into the rule.java.lang.String
getCacheId()
The Java Vendor not changed during one Maven session, so can be cached.void
setExcludes(java.util.List<java.lang.String> excludes)
Specify the banned vendors.void
setIncludes(java.util.List<java.lang.String> includes)
Specify the allowed vendor names.java.lang.String
toString()
-
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getLevel, getRuleName
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
-
-
-
Method Detail
-
getCacheId
public java.lang.String getCacheId()
The Java Vendor not changed during one Maven session, so can be cached.- Overrides:
getCacheId
in classAbstractEnforcerRule
- Returns:
- a cache id
-
execute
public void execute() throws EnforcerRuleException
Description copied from class:AbstractEnforcerRule
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 and rule level if it should stop or just log the message as a warning.- Specified by:
execute
in classAbstractEnforcerRule
- Throws:
EnforcerRuleException
- the enforcer rule exceptionEnforcerRuleError
- in order to brake a build immediately
-
setExcludes
public void setExcludes(java.util.List<java.lang.String> excludes)
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:
excludes
- the vendors to exclude from the include list
-
setIncludes
public void setIncludes(java.util.List<java.lang.String> includes)
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:
includes
- the list of required vendors- See Also:
setExcludes(List)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-