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
public class RequireNoRepositories extends AbstractNonCacheableEnforcerRule
This rule checks that this pom or its parents don't define a repository.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>allowedPluginRepositoriesSpecify explicitly allowed plugin repositories.private java.util.List<java.lang.String>allowedRepositoriesSpecify explicitly allowed non-plugin repositories.private booleanallowSnapshotPluginRepositoriesWhether to allow plugin repositories which only resolve snapshots.private booleanallowSnapshotRepositoriesWhether to allow repositories which only resolve snapshots.private booleanbanPluginRepositoriesWhether to ban plugin repositories.private booleanbanRepositoriesWhether to ban non-plugin repositories.private org.apache.maven.plugin.logging.Logloggerprivate static java.lang.StringVERSION
-
Constructor Summary
Constructors Constructor Description RequireNoRepositories()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(EnforcerRuleHelper helper)This is the interface into the rule.private static java.util.List<java.lang.String>findBannedRepositories(java.util.List<org.apache.maven.model.Repository> repos, java.util.List<java.lang.String> allowedRepos, boolean allowSnapshots)voidsetAllowedPluginRepositories(java.util.List<java.lang.String> allowedPluginRepositories)voidsetAllowedRepositories(java.util.List<java.lang.String> allowedRepositories)voidsetAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories)voidsetAllowSnapshotRepositories(boolean allowSnapshotRepositories)voidsetBanPluginRepositories(boolean banPluginRepositories)voidsetBanRepositories(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 Detail
-
VERSION
private static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
banRepositories
private boolean banRepositories
Whether to ban non-plugin repositories. By default they are banned.- See Also:
setBanRepositories(boolean)
-
banPluginRepositories
private boolean banPluginRepositories
Whether to ban plugin repositories. By default they are banned.- See Also:
setBanPluginRepositories(boolean)
-
allowedRepositories
private java.util.List<java.lang.String> allowedRepositories
Specify explicitly allowed non-plugin repositories. This is a list of ids.- See Also:
setAllowedRepositories(List)
-
allowedPluginRepositories
private java.util.List<java.lang.String> allowedPluginRepositories
Specify explicitly allowed plugin repositories. This is a list of ids.- See Also:
setAllowedPluginRepositories(List)
-
allowSnapshotRepositories
private boolean allowSnapshotRepositories
Whether to allow repositories which only resolve snapshots. By default they are banned.- See Also:
setAllowSnapshotRepositories(boolean)
-
allowSnapshotPluginRepositories
private boolean allowSnapshotPluginRepositories
Whether to allow plugin repositories which only resolve snapshots. By default they are banned.
-
logger
private org.apache.maven.plugin.logging.Log logger
-
-
Method Detail
-
setBanRepositories
public final void setBanRepositories(boolean banRepositories)
-
setBanPluginRepositories
public final void setBanPluginRepositories(boolean banPluginRepositories)
-
setAllowedRepositories
public final void setAllowedRepositories(java.util.List<java.lang.String> allowedRepositories)
-
setAllowedPluginRepositories
public final void setAllowedPluginRepositories(java.util.List<java.lang.String> allowedPluginRepositories)
-
setAllowSnapshotRepositories
public final void setAllowSnapshotRepositories(boolean allowSnapshotRepositories)
-
setAllowSnapshotPluginRepositories
public final void setAllowSnapshotPluginRepositories(boolean allowSnapshotPluginRepositories)
-
execute
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
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 java.util.List<java.lang.String> findBannedRepositories(java.util.List<org.apache.maven.model.Repository> repos, java.util.List<java.lang.String> allowedRepos, boolean allowSnapshots)- Parameters:
repos- all repositories, nevernullallowedRepos- allowed repositories, nevernullallowSnapshots-- Returns:
- List of banned repositoreis.
-
-