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 boolean
Whether to allow plugin repositories which only resolve snapshots.private boolean
Whether to allow repositories which only resolve snapshots.private boolean
Whether to ban plugin repositories.private boolean
Whether to ban non-plugin repositories.private org.apache.maven.plugin.logging.Log
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(EnforcerRuleHelper helper) This is the interface into the rule.findBannedRepositories
(List<org.apache.maven.model.Repository> repos, List<String> allowedRepos, boolean allowSnapshots) final void
setAllowedPluginRepositories
(List<String> allowedPluginRepositories) final void
setAllowedRepositories
(List<String> allowedRepositories) final void
setAllowSnapshotPluginRepositories
(boolean allowSnapshotPluginRepositories) final void
setAllowSnapshotRepositories
(boolean allowSnapshotRepositories) final void
setBanPluginRepositories
(boolean banPluginRepositories) final void
setBanRepositories
(boolean banRepositories) Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValid
Methods 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:EnforcerRule
This 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, nevernull
allowedRepos
- allowed repositories, nevernull
allowSnapshots
-- Returns:
- List of banned repositoreis.
-