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 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 final org.apache.maven.execution.MavenSession
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
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) void
setAllowedPluginRepositories
(List<String> allowedPluginRepositories) void
setAllowedRepositories
(List<String> allowedRepositories) void
setAllowSnapshotPluginRepositories
(boolean allowSnapshotPluginRepositories) void
setAllowSnapshotRepositories
(boolean allowSnapshotRepositories) void
setBanPluginRepositories
(boolean banPluginRepositories) void
setBanRepositories
(boolean banRepositories) toString()
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel
Methods 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:AbstractEnforcerRule
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 and rule level if it should stop or just log the message as a warning.- Specified by:
execute
in 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, nevernull
allowedRepos
- allowed repositories, nevernull
allowSnapshots
-- Returns:
- List of banned repositoreis.
-
toString
-