Package org.apache.maven.enforcer.rules
Class RequireNoRepositories
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.RequireNoRepositories
- All Implemented Interfaces:
EnforcerRuleBase
@Named("requireNoRepositories")
public final class RequireNoRepositories
extends AbstractStandardEnforcerRule
This rule checks that this pom or its parents don't define a repository.
-
Field Summary
FieldsModifier and TypeFieldDescriptionSpecify explicitly allowed plugin repositories.Specify explicitly allowed non-plugin repositories.private booleanWhether to allow plugin repositories which only resolve snapshots.private booleanWhether to allow repositories which only resolve snapshots.private booleanWhether to ban plugin repositories.private booleanWhether to ban non-plugin repositories.private final org.apache.maven.execution.MavenSessionprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This is the interface into the rule.findBannedRepositories(List<org.apache.maven.model.Repository> repos, List<String> allowedRepos, boolean allowSnapshots) private Collection<String> getRepoIdsFromSettings(Function<org.apache.maven.settings.Profile, List<org.apache.maven.settings.Repository>> getRepositoriesFunc) voidsetAllowedPluginRepositories(List<String> allowedPluginRepositories) voidsetAllowedRepositories(List<String> allowedRepositories) voidsetAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories) voidsetAllowSnapshotRepositories(boolean allowSnapshotRepositories) voidsetBanPluginRepositories(boolean banPluginRepositories) voidsetBanRepositories(boolean banRepositories) toString()Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevelMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
VERSION
- See Also:
-
banRepositories
private boolean banRepositoriesWhether to ban non-plugin repositories. By default they are banned.- See Also:
-
banPluginRepositories
private boolean banPluginRepositoriesWhether to ban plugin repositories. By default they are banned.- See Also:
-
allowedRepositories
Specify explicitly allowed non-plugin repositories. This is a list of ids.- See Also:
-
allowedPluginRepositories
Specify explicitly allowed plugin repositories. This is a list of ids.- See Also:
-
allowSnapshotRepositories
private boolean allowSnapshotRepositoriesWhether to allow repositories which only resolve snapshots. By default they are banned.- See Also:
-
allowSnapshotPluginRepositories
private boolean allowSnapshotPluginRepositoriesWhether to allow plugin repositories which only resolve snapshots. By default they are banned.- See Also:
-
session
private final org.apache.maven.execution.MavenSession session
-
-
Constructor Details
-
RequireNoRepositories
@Inject public RequireNoRepositories(org.apache.maven.execution.MavenSession session)
-
-
Method Details
-
setBanRepositories
public void setBanRepositories(boolean banRepositories) -
setBanPluginRepositories
public void setBanPluginRepositories(boolean banPluginRepositories) -
setAllowedRepositories
-
setAllowedPluginRepositories
-
setAllowSnapshotRepositories
public void setAllowSnapshotRepositories(boolean allowSnapshotRepositories) -
setAllowSnapshotPluginRepositories
public void setAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories) -
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
-
getRepoIdsFromSettings
private Collection<String> getRepoIdsFromSettings(Function<org.apache.maven.settings.Profile, List<org.apache.maven.settings.Repository>> getRepositoriesFunc) -
findBannedRepositories
private static List<String> findBannedRepositories(List<org.apache.maven.model.Repository> repos, List<String> allowedRepos, boolean allowSnapshots) - Parameters:
repos- all repositories, nevernullallowedRepos- allowed repositories, nevernullallowSnapshots-- Returns:
- List of banned repositoreis.
-
toString
-