Class RequireUpperBoundDeps
java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
org.apache.maven.plugins.enforcer.RequireUpperBoundDeps
- All Implemented Interfaces:
EnforcerRule,EnforcerRule2
Rule to enforce that the resolved dependency is also the most recent one of all transitive dependencies.
- Since:
- 1.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringbuildErrorMessage(List<org.apache.maven.shared.dependency.graph.DependencyNode> conflict) buildErrorMessages(List<List<org.apache.maven.shared.dependency.graph.DependencyNode>> conflicts) private StringBuilderbuildTreeString(org.apache.maven.shared.dependency.graph.DependencyNode node) voidexecute(EnforcerRuleHelper helper) This is the interface into the rule.private StringgetFullArtifactName(org.apache.maven.shared.dependency.graph.DependencyNode node, boolean usePremanaged) private org.apache.maven.shared.dependency.graph.DependencyNodegetNode(EnforcerRuleHelper helper) Uses theEnforcerRuleHelperto populate the values of theDependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)factory method.voidsetExcludes(List<String> excludes) Sets dependencies to exclude.voidsetIncludes(List<String> includes) Sets dependencies to include.voidsetUniqueVersions(boolean uniqueVersions) Set totrueif timestamped snapshots should be used.Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValidMethods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
Field Details
-
log
private static org.apache.maven.plugin.logging.Log log -
uniqueVersions
private boolean uniqueVersions- Since:
- 1.3
-
excludes
Dependencies to ignore.- Since:
- TBD
-
includes
Dependencies to include.- Since:
- 3.0.0
-
-
Constructor Details
-
RequireUpperBoundDeps
public RequireUpperBoundDeps()
-
-
Method Details
-
setUniqueVersions
public void setUniqueVersions(boolean uniqueVersions) Set totrueif timestamped snapshots should be used.- Parameters:
uniqueVersions-- Since:
- 1.3
-
setExcludes
Sets dependencies to exclude.- Parameters:
excludes- a list ofgroupId:artifactIdnames
-
setIncludes
Sets dependencies to include.- Parameters:
includes- a list ofgroupId:artifactIdnames
-
getNode
private org.apache.maven.shared.dependency.graph.DependencyNode getNode(EnforcerRuleHelper helper) throws EnforcerRuleException Uses theEnforcerRuleHelperto populate the values of theDependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)factory method.
This method simply exists to hide all the ugly lookup that theEnforcerRuleHelperhas to do.- Parameters:
helper-- Returns:
- a Dependency Node which is the root of the project's dependency tree
- Throws:
EnforcerRuleException- when the build should fail
-
execute
Description copied from interface:EnforcerRuleThis 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 if it should stop or just log the message as a warning.- Parameters:
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.- Throws:
EnforcerRuleException- the enforcer rule exception
-
buildErrorMessages
-
buildErrorMessage
-