Class PedanticDependencyElementEnforcer
java.lang.Object
com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
com.github.ferstl.maven.pomenforcers.PedanticDependencyElementEnforcer
- All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule,org.apache.maven.enforcer.rule.api.EnforcerRule2
This enforcer makes sure that elements in the <dependencyManagement> and <dependencies> sections are ordered.
### Example
<rules>
<dependencyElements implementation="com.github.ferstl.maven.pomenforcers.PedanticDependencyElementEnforcer">
<!-- Define the order within dependencies -->
<elementPriorities>groupId,artifactId,version</elementPriorities>
<!-- Check the dependency management section -->
<checkDependencyManagement>true</checkDependencyManagement>
<!-- Check the dependencies section -->
<checkDependencies>true</checkDependencies>
</dependencyElements>
</rules>
- Since:
- 2.0.0
- Enforcer Rule ID:
PedanticEnforcerRule.DEPENDENCY_ELEMENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(PedanticEnforcerVisitor visitor)protected voiddoEnforce(ErrorReport report)protected PedanticEnforcerRulevoidsetCheckDependencies(boolean checkDependencies)Check the <dependencies> section.voidsetCheckDependencyManagement(boolean checkDependencyManagement)Check the <dependencyManagement> section.voidsetElementPriorities(String elements)Comma-separated list of section elements in the order as they should appear.Methods inherited from class com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
execute, getCacheId, getHelper, getLevel, getPom, getProjectModel, isCacheable, isResultValid
-
Constructor Details
-
PedanticDependencyElementEnforcer
public PedanticDependencyElementEnforcer()
-
-
Method Details
-
setElementPriorities
Comma-separated list of section elements in the order as they should appear. This will overwrite the default order by putting all unspecified elements at the end.- Parameters:
elements- Comma separated list of elements as they should appear.- Since:
- 2.0.0
- Enforcer Configuration Parameter
- Default Value:
- groupId, artifactId, version, classifier, type, scope, systemPath, optional, exclusions
-
setCheckDependencies
public void setCheckDependencies(boolean checkDependencies)Check the <dependencies> section.- Parameters:
checkDependencies-trueto check the <dependencies> section,falseelse.- Since:
- 2.0.0
- Enforcer Configuration Parameter
- Default Value:
- true
-
setCheckDependencyManagement
public void setCheckDependencyManagement(boolean checkDependencyManagement)Check the <dependencyManagement> section.- Parameters:
checkDependencyManagement-trueto check the <dependencyManagement> section,falseelse.- Since:
- 2.0.0
- Enforcer Configuration Parameter
- Default Value:
- true
-
getDescription
- Specified by:
getDescriptionin classAbstractPedanticEnforcer
-
doEnforce
- Specified by:
doEnforcein classAbstractPedanticEnforcer
-
accept
- Specified by:
acceptin classAbstractPedanticEnforcer
-