Class RequireNoRepositories
java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
org.apache.maven.plugins.enforcer.RequireNoRepositories
- All Implemented Interfaces:
EnforcerRule,EnforcerRule2
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 org.apache.maven.plugin.logging.Logprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(EnforcerRuleHelper helper) This is the interface into the rule.findBannedRepositories(List<org.apache.maven.model.Repository> repos, List<String> allowedRepos, boolean allowSnapshots) final voidsetAllowedPluginRepositories(List<String> allowedPluginRepositories) final voidsetAllowedRepositories(List<String> allowedRepositories) final voidsetAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories) final voidsetAllowSnapshotRepositories(boolean allowSnapshotRepositories) final voidsetBanPluginRepositories(boolean banPluginRepositories) final voidsetBanRepositories(boolean banRepositories) Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValidMethods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
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. -
logger
private org.apache.maven.plugin.logging.Log logger
-
-
Constructor Details
-
RequireNoRepositories
public RequireNoRepositories()
-
-
Method Details
-
setBanRepositories
public final void setBanRepositories(boolean banRepositories) -
setBanPluginRepositories
public final void setBanPluginRepositories(boolean banPluginRepositories) -
setAllowedRepositories
-
setAllowedPluginRepositories
-
setAllowSnapshotRepositories
public final void setAllowSnapshotRepositories(boolean allowSnapshotRepositories) -
setAllowSnapshotPluginRepositories
public final void setAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories) -
execute
Description copied from interface:EnforcerRuleThis 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
-
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.
-