public class DependencyConvergence extends java.lang.Object implements EnforcerRule
Modifier and Type | Field and Description |
---|---|
private static org.apache.maven.plugin.logging.Log |
log |
private boolean |
uniqueVersions |
Constructor and Description |
---|
DependencyConvergence() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
buildConvergenceErrorMsg(java.util.List<org.apache.maven.shared.dependency.graph.DependencyNode> nodeList) |
private java.lang.StringBuilder |
buildTreeString(org.apache.maven.shared.dependency.graph.DependencyNode node) |
void |
execute(EnforcerRuleHelper helper)
This is the interface into the rule.
|
java.lang.String |
getCacheId()
If the rule is to be cached, this id is used as part of the key.
|
private java.util.List<java.lang.String> |
getConvergenceErrorMsgs(java.util.List<java.util.List<org.apache.maven.shared.dependency.graph.DependencyNode>> errors) |
private java.lang.String |
getFullArtifactName(org.apache.maven.artifact.Artifact artifact) |
private org.apache.maven.shared.dependency.graph.DependencyNode |
getNode(EnforcerRuleHelper helper)
Uses the
EnforcerRuleHelper to populate the values of the
DependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)
factory method. |
boolean |
isCacheable()
This method tells the enforcer if the rule results may be cached.
|
boolean |
isResultValid(EnforcerRule rule)
If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
allow double checking of the results.
|
void |
setUniqueVersions(boolean uniqueVersions) |
private static org.apache.maven.plugin.logging.Log log
private boolean uniqueVersions
public void setUniqueVersions(boolean uniqueVersions)
private org.apache.maven.shared.dependency.graph.DependencyNode getNode(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRuleHelper
to populate the values of the
DependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)
factory method. EnforcerRuleHelper
has to do.helper
- EnforcerRuleException
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRule
execute
in interface EnforcerRule
helper
- The helper provides access to the log, MavenSession and has
helpers to get common components. It is also able to lookup components
by class name.EnforcerRuleException
- the enforcer rule exceptionprivate java.lang.String getFullArtifactName(org.apache.maven.artifact.Artifact artifact)
private java.lang.StringBuilder buildTreeString(org.apache.maven.shared.dependency.graph.DependencyNode node)
private java.util.List<java.lang.String> getConvergenceErrorMsgs(java.util.List<java.util.List<org.apache.maven.shared.dependency.graph.DependencyNode>> errors)
private java.lang.String buildConvergenceErrorMsg(java.util.List<org.apache.maven.shared.dependency.graph.DependencyNode> nodeList)
public java.lang.String getCacheId()
EnforcerRule
getCacheId
in interface EnforcerRule
public boolean isCacheable()
EnforcerRule
isCacheable
in interface EnforcerRule
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule rule)
EnforcerRule
isResultValid
in interface EnforcerRule
rule
- the last cached instance of the rule. This is to be used by the rule to
potentially determine if the results are still valid (ie if the configuration has been overridden)true
if the stored results are valid for the same id.