Class BanDependencyManagementScope
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.BanDependencyManagementScope
- All Implemented Interfaces:
EnforcerRuleBase
@Named("banDependencyManagementScope")
public final class BanDependencyManagementScope
extends AbstractStandardEnforcerRule
This rule bans all scope values except for
import from dependencies within the dependency management.
There is a configuration option to ignore certain dependencies in this check.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIftruethe dependencyManagement from imported dependencyManagement and parent pom's is checked as well, otherwise only the local dependencyManagement defined in the current project's pom.xml.Specify the dependencies that will be ignored.private final org.apache.maven.project.MavenProject -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This is the interface into the rule.private static CharSequencegetErrorMessage(org.apache.maven.project.MavenProject project, org.apache.maven.model.Dependency violatingDependency) (package private) List<org.apache.maven.model.Dependency> getViolatingDependencies(org.apache.maven.model.DependencyManagement depMgmt) voidsetExcludes(List<String> excludes) toString()Methods inherited from class AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class AbstractEnforcerRule
getCacheId, getLevel, getRuleNameMethods inherited from class AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
excludes
Specify the dependencies that will be ignored. This can be a list of artifacts in the formatgroupId[:artifactId][:version][:type][:scope]. Wildcard '*' can be used to in place of specific section (ie group:*:1.0 will match both 'group:artifact:1.0' and 'group:anotherArtifact:1.0'). Version is a string representing standard Maven version range. Empty patterns will be ignored. -
checkEffectivePom
private boolean checkEffectivePomIftruethe dependencyManagement from imported dependencyManagement and parent pom's is checked as well, otherwise only the local dependencyManagement defined in the current project's pom.xml. -
project
private final org.apache.maven.project.MavenProject project
-
-
Constructor Details
-
BanDependencyManagementScope
@Inject public BanDependencyManagementScope(org.apache.maven.project.MavenProject project)
-
-
Method Details
-
execute
Description 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.- Specified by:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exception
-
getViolatingDependencies
List<org.apache.maven.model.Dependency> getViolatingDependencies(org.apache.maven.model.DependencyManagement depMgmt) -
getErrorMessage
private static CharSequence getErrorMessage(org.apache.maven.project.MavenProject project, org.apache.maven.model.Dependency violatingDependency) -
setExcludes
-
toString
-