Package org.xwiki.tool.enforcer
Class ValidateDependencyVersion
- java.lang.Object
-
- org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
-
- org.xwiki.tool.enforcer.AbstractPomCheck
-
- org.xwiki.tool.enforcer.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 Summary
Constructors Constructor Description ValidateDependencyVersion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVersionCheck(VersionCheck versionCheck)
Add a new dependency version check.void
execute()
org.apache.maven.enforcer.rule.api.EnforcerLogger
getLog()
void
setLog(org.apache.maven.enforcer.rule.api.EnforcerLogger arg0)
-
Methods inherited from class org.xwiki.tool.enforcer.AbstractPomCheck
getModel, getResolvedModel
-
-
-
-
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 classorg.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 interfaceorg.apache.maven.enforcer.rule.api.EnforcerRuleBase
-
getLog
public org.apache.maven.enforcer.rule.api.EnforcerLogger getLog()
-
-