Package org.apache.maven.enforcer.rules
Class BanDuplicatePomDependencyVersions
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.BanDuplicatePomDependencyVersions
- All Implemented Interfaces:
EnforcerRuleBase
@Named("banDuplicatePomDependencyVersions")
public final class BanDuplicatePomDependencyVersions
extends AbstractStandardEnforcerRule
Since Maven 3 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique. Early versions of Maven
3 already warn, this rule can force to break a build for this reason.
- Since:
- 1.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBanDuplicatePomDependencyVersions
(org.apache.maven.project.MavenProject project) -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
This is the interface into the rule.private void
maven2Validation
(org.apache.maven.model.Model model) private void
messageBuilder
(Map<String, Integer> duplicateDependencies, String prefix, StringBuilder message) validateDependencies
(List<org.apache.maven.model.Dependency> dependencies) Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
project
private final org.apache.maven.project.MavenProject project
-
-
Constructor Details
-
BanDuplicatePomDependencyVersions
@Inject public BanDuplicatePomDependencyVersions(org.apache.maven.project.MavenProject project)
-
-
Method Details
-
execute
Description copied from class:AbstractEnforcerRule
This 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:
execute
in classAbstractEnforcerRule
- Throws:
EnforcerRuleException
- the enforcer rule exception
-
maven2Validation
- Throws:
EnforcerRuleException
-
messageBuilder
private void messageBuilder(Map<String, Integer> duplicateDependencies, String prefix, StringBuilder message) -
validateDependencies
-