Class BannedRepositories
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.BannedRepositories
- All Implemented Interfaces:
EnforcerRuleBase
@Named("bannedRepositories")
public final class BannedRepositories
extends AbstractStandardEnforcerRule
This rule checks whether this project's maven session has banned repositories.
-
Field Summary
FieldsModifier and TypeFieldDescriptionSpecify explicitly allowed plugin repositories, then all others repositories would be banned.Specify explicitly allowed non-plugin repositories, then all others repositories would be banned.Specify explicitly banned plugin repositories.Specify explicitly banned non-plugin repositories.private final org.apache.maven.project.MavenProject -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate List<org.apache.maven.artifact.repository.ArtifactRepository> checkRepositories(List<org.apache.maven.artifact.repository.ArtifactRepository> repositories, List<String> includes, List<String> excludes) Check whether specified repositories have banned repositories.voidexecute()This is the interface into the rule.private StringgetRepositoryUrlString(List<org.apache.maven.artifact.repository.ArtifactRepository> resultBannedRepos) private booleanprivate booleanprivate StringpopulateErrorMessage(List<org.apache.maven.artifact.repository.ArtifactRepository> resultBannedRepos, String errorMessagePrefix) (package private) voidsetAllowedPluginRepositories(List<String> allowedPluginRepositories) (package private) voidsetAllowedRepositories(List<String> allowedRepositories) (package private) voidsetBannedRepositories(List<String> bannedRepositories) toString()Methods inherited from class AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class AbstractEnforcerRule
getCacheId, getLevel, getRuleNameMethods inherited from class AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
bannedRepositories
-
bannedPluginRepositories
-
allowedRepositories
-
allowedPluginRepositories
-
project
private final org.apache.maven.project.MavenProject project
-
-
Constructor Details
-
BannedRepositories
@Inject public BannedRepositories(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
-
setBannedRepositories
-
setAllowedRepositories
-
setAllowedPluginRepositories
-
checkRepositories
private List<org.apache.maven.artifact.repository.ArtifactRepository> checkRepositories(List<org.apache.maven.artifact.repository.ArtifactRepository> repositories, List<String> includes, List<String> excludes) Check whether specified repositories have banned repositories.- Parameters:
repositories- : candidate repositories.includes- : 'include' patterns.excludes- : 'exclude' patterns.- Returns:
- Banned repositories.
-
match
-
match
-
populateErrorMessage
-
getRepositoryUrlString
-
toString
-