Class RequireJavaVersion
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.version.AbstractVersionEnforcer
org.apache.maven.enforcer.rules.version.RequireJavaVersion
- All Implemented Interfaces:
EnforcerRuleBase
This rule checks that the Java version is allowed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanDisplay the normalized JDK version.private static final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This is the interface into the rule.static StringnormalizeJDKVersion(String jdkVersion) Converts a JDK string from 1.5.0-11b12 to a single 3 digit version like 1.5.0-11private voidsetCustomMessageIfNoneConfigured(org.apache.maven.artifact.versioning.ArtifactVersion detectedJdkVersion, String allowedVersionRange) voidsetVersion(String version) Specify the required version.toString()Methods inherited from class AbstractVersionEnforcer
enforceVersion, getCacheId, getVersion, toStringMethods inherited from class AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class AbstractEnforcerRule
getLevel, getRuleNameMethods inherited from class AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
JDK8_VERSION_PATTERN
-
display
private boolean displayDisplay the normalized JDK version.
-
-
Constructor Details
-
RequireJavaVersion
public RequireJavaVersion()
-
-
Method Details
-
setVersion
Description copied from class:AbstractVersionEnforcerSpecify the required version. Some examples are:2.0.4Version 2.0.4 and higher (different from Maven meaning)[2.0,2.1)Versions 2.0 (included) to 2.1 (not included)[2.0,2.1]Versions 2.0 to 2.1 (both included)[2.0.5,)Versions 2.0.5 and higher(,2.0.5],[2.1.1,)Versions up to 2.0.5 (included) and 2.1.1 or higher
- Overrides:
setVersionin classAbstractVersionEnforcer- Parameters:
version- the required version to set
-
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
-
normalizeJDKVersion
-
setCustomMessageIfNoneConfigured
private void setCustomMessageIfNoneConfigured(org.apache.maven.artifact.versioning.ArtifactVersion detectedJdkVersion, String allowedVersionRange) -
toString
-