Class ValidateDependencyVersion

  • All Implemented Interfaces:
    org.apache.maven.enforcer.rule.api.EnforcerRuleBase

    @Named("validateDependencyVersion")
    public class ValidateDependencyVersion
    extends AbstractPomCheck
    Performs checks on the version specified for dependencies in pom.xml files. For example if we're in XWiki Rendering and there's a dependency on some XWiki Commons module we might want to ensure that it uses a variable (such as ${commons.version}) and not ${project.version}. To achieve this you would use:
    
       <rules>
         <validateDependencyVersion implementation="org.xwiki.tool.enforcer.ValidateDependencyVersion">
           <versionCheck>
             <groupIdPrefix>org.xwiki.commons</groupIdPrefix>
             <allowedVersionRegex>\$\{project.version\}|[^$].*</allowedVersionRege>
           </versionCheck>
         </validateDependencyVersion>
       </rules>
     
    Since:
    4.5RC1
    Version:
    $Id: 34996e1689155d907f0a88c2d86dc5b70d7164a1 $
    • Constructor Detail

      • ValidateDependencyVersion

        public ValidateDependencyVersion()
    • Method Detail

      • addVersionCheck

        public void addVersionCheck​(VersionCheck versionCheck)
        Add a new dependency version check. Called automatically by the Maven framework when the following construct is defined in a pom.xml file:
        
           <versionCheck>
             <groupIdPrefix>org.xwiki.commons</groupIdPrefix>
             <allowedVersionRegex>.*</allowedVersionRegex>
           </versionCheck>
         
        Parameters:
        versionCheck - the check to add
      • execute

        public void execute()
                     throws org.apache.maven.enforcer.rule.api.EnforcerRuleException
        Specified by:
        execute in class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
        Throws:
        org.apache.maven.enforcer.rule.api.EnforcerRuleException
      • setLog

        public void setLog​(org.apache.maven.enforcer.rule.api.EnforcerLogger arg0)
        Specified by:
        setLog in interface org.apache.maven.enforcer.rule.api.EnforcerRuleBase
      • getLog

        public org.apache.maven.enforcer.rule.api.EnforcerLogger getLog()