Class BannedDependencies
- 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.dependency.BannedDependenciesBase
-
- org.apache.maven.enforcer.rules.dependency.BannedDependencies
-
- All Implemented Interfaces:
EnforcerRuleBase
@Named("bannedDependencies") public final class BannedDependencies extends BannedDependenciesBaseThis rule checks that lists of dependencies are not included.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Predicate<org.apache.maven.artifact.Artifact>shouldExcludeprivate java.util.function.Predicate<org.apache.maven.artifact.Artifact>shouldInclude
-
Constructor Summary
Constructors Constructor Description BannedDependencies(org.apache.maven.execution.MavenSession session, ResolverUtil resolverUtil)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()This is the interface into the rule.protected java.lang.StringgetErrorMessage()java.lang.StringtoString()protected booleanvalidate(org.apache.maven.artifact.Artifact artifact)Validates a dependency artifact if it fulfills the enforcer rule-
Methods inherited from class org.apache.maven.enforcer.rules.dependency.BannedDependenciesBase
getExcludes, getIncludes, getSession, isSearchTransitive, setExcludes, setIncludes, setSearchTransitive, validate
-
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, getRuleName
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
-
-
-
Constructor Detail
-
BannedDependencies
@Inject BannedDependencies(org.apache.maven.execution.MavenSession session, ResolverUtil resolverUtil)
-
-
Method Detail
-
execute
public void execute() throws EnforcerRuleExceptionDescription copied from class:AbstractEnforcerRuleThis 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.- Overrides:
executein classBannedDependenciesBase- Throws:
EnforcerRuleException- the enforcer rule exceptionEnforcerRuleError- in order to brake a build immediately
-
validate
protected boolean validate(org.apache.maven.artifact.Artifact artifact)
Description copied from class:BannedDependenciesBaseValidates a dependency artifact if it fulfills the enforcer rule- Specified by:
validatein classBannedDependenciesBase- Parameters:
artifact- dependency to be checked against the list of excludes- Returns:
trueif the dependency passes the rule,falseif the dependency triggers a validation error
-
getErrorMessage
protected java.lang.String getErrorMessage()
- Specified by:
getErrorMessagein classBannedDependenciesBase
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-