Class AbstractBanDependencies
java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
org.apache.maven.plugins.enforcer.AbstractBanDependencies
- All Implemented Interfaces:
EnforcerRule
,EnforcerRule2
- Direct Known Subclasses:
BannedDependencies
,RequireReleaseDeps
Abstract Rule for banning dependencies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.shared.dependency.graph.DependencyGraphBuilder
private boolean
Specify if transitive dependencies should be searched (default) or only look at direct dependencies. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Set<org.apache.maven.artifact.Artifact>
checkDependencies
(Set<org.apache.maven.artifact.Artifact> dependencies, org.apache.maven.plugin.logging.Log log) Checks the set of dependencies against the list of excludes.void
execute
(EnforcerRuleHelper helper) This is the interface into the rule.protected Set<org.apache.maven.artifact.Artifact>
getDependenciesToCheck
(org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest) protected CharSequence
getErrorMessage
(org.apache.maven.artifact.Artifact artifact) boolean
Checks if is search transitive.void
setSearchTransitive
(boolean theSearchTransitive) Sets the search transitive.Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValid
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
Field Details
-
searchTransitive
private boolean searchTransitiveSpecify if transitive dependencies should be searched (default) or only look at direct dependencies. -
graphBuilder
private transient org.apache.maven.shared.dependency.graph.DependencyGraphBuilder graphBuilder
-
-
Constructor Details
-
AbstractBanDependencies
public AbstractBanDependencies()
-
-
Method Details
-
execute
Description copied from interface:EnforcerRule
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 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
-
getErrorMessage
-
getDependenciesToCheck
protected Set<org.apache.maven.artifact.Artifact> getDependenciesToCheck(org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest) -
checkDependencies
protected abstract Set<org.apache.maven.artifact.Artifact> checkDependencies(Set<org.apache.maven.artifact.Artifact> dependencies, org.apache.maven.plugin.logging.Log log) throws EnforcerRuleException Checks the set of dependencies against the list of excludes.- Parameters:
dependencies
- the dependencieslog
- the log- Returns:
- the sets the
- Throws:
EnforcerRuleException
- the enforcer rule exception
-
isSearchTransitive
public boolean isSearchTransitive()Checks if is search transitive.- Returns:
- the searchTransitive
-
setSearchTransitive
public void setSearchTransitive(boolean theSearchTransitive) Sets the search transitive.- Parameters:
theSearchTransitive
- the searchTransitive to set
-