Class RequireMavenVersion

All Implemented Interfaces:
EnforcerRuleBase

@Named("requireMavenVersion") public final class RequireMavenVersion extends AbstractStandardEnforcerRule
This rule checks that the Maven version is allowed.
Author:
Brian Fox
  • Constructor Details

    • RequireMavenVersion

      @Inject public RequireMavenVersion(org.apache.maven.rtinfo.RuntimeInformation runtimeInformation)
  • Method Details

    • execute

      public void execute() throws EnforcerRuleException
      Specified by:
      execute in class AbstractEnforcerRule
      Throws:
      EnforcerRuleException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • enforceVersion

      public void enforceVersion(String variableName, String requiredVersionRange, org.apache.maven.artifact.versioning.ArtifactVersion actualVersion) throws EnforcerRuleException
      Compares the specified version to see if it is allowed by the defined version range.
      Parameters:
      variableName - name of variable to use in messages (Example: "Maven" or "Java" etc).
      requiredVersionRange - range of allowed versions.
      actualVersion - the version to be checked.
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • toString

      protected static String toString(org.apache.maven.artifact.versioning.VersionRange vr)
    • getCacheId

      public String getCacheId()
      Overrides:
      getCacheId in class AbstractEnforcerRule
    • getVersion

      public final String getVersion()
      Gets the required version.
      Returns:
      the required version
    • setVersion

      public void setVersion(String theVersion)
      Specify the required version. Some examples are:
      • 2.0.4 Version 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
      Parameters:
      theVersion - the required version to set
    • setLog

      public void setLog(EnforcerLogger arg0)
      Specified by:
      setLog in interface EnforcerRuleBase
    • getLog

      public EnforcerLogger getLog()