Class RequireReleaseDeps
- java.lang.Object
-
- org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractBanDependencies
-
- org.apache.maven.plugins.enforcer.RequireReleaseDeps
-
- All Implemented Interfaces:
EnforcerRule
,EnforcerRule2
public class RequireReleaseDeps extends AbstractBanDependencies
This rule checks that no snapshots are included.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
excludes
Dependencies to ignore when checking for release versions.private boolean
failWhenParentIsSnapshot
Allows this rule to fail when the parent is defined as a snapshot.private java.util.List<java.lang.String>
includes
Dependencies to include when checking for release versions.private boolean
onlyWhenRelease
Allows this rule to execute only when this project is a release.
-
Constructor Summary
Constructors Constructor Description RequireReleaseDeps()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<org.apache.maven.artifact.Artifact>
checkDependencies(java.util.Set<org.apache.maven.artifact.Artifact> dependencies, org.apache.maven.plugin.logging.Log log)
Checks the set of dependencies against the list of excludes.void
execute(EnforcerRuleHelper helper)
This is the interface into the rule.java.util.Set<org.apache.maven.artifact.Artifact>
filterArtifacts(java.util.Set<org.apache.maven.artifact.Artifact> dependencies)
java.util.List<java.lang.String>
getExcludes()
java.util.List<java.lang.String>
getIncludes()
private org.apache.maven.project.MavenProject
getProject(EnforcerRuleHelper helper)
boolean
isFailWhenParentIsSnapshot()
boolean
isOnlyWhenRelease()
void
setExcludes(java.util.List<java.lang.String> excludes)
void
setFailWhenParentIsSnapshot(boolean failWhenParentIsSnapshot)
void
setIncludes(java.util.List<java.lang.String> includes)
void
setOnlyWhenRelease(boolean onlyWhenRelease)
-
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractBanDependencies
getDependenciesToCheck, getErrorMessage, isSearchTransitive, setSearchTransitive
-
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
-
onlyWhenRelease
private boolean onlyWhenRelease
Allows this rule to execute only when this project is a release.
-
failWhenParentIsSnapshot
private boolean failWhenParentIsSnapshot
Allows this rule to fail when the parent is defined as a snapshot.
-
excludes
private java.util.List<java.lang.String> excludes
Dependencies to ignore when checking for release versions. For example, inter-module dependencies can be excluded from the check and therefore allowed to contain snapshot versions.
-
includes
private java.util.List<java.lang.String> includes
Dependencies to include when checking for release versions. If any of the included dependencies have snapshot versions, the rule will fail.
-
-
Method Detail
-
execute
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
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.- Specified by:
execute
in interfaceEnforcerRule
- Overrides:
execute
in classAbstractBanDependencies
- 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
-
getProject
private org.apache.maven.project.MavenProject getProject(EnforcerRuleHelper helper) throws EnforcerRuleException
- Parameters:
helper
-- Returns:
- The evaluated
MavenProject
. - Throws:
EnforcerRuleException
-
checkDependencies
protected java.util.Set<org.apache.maven.artifact.Artifact> checkDependencies(java.util.Set<org.apache.maven.artifact.Artifact> dependencies, org.apache.maven.plugin.logging.Log log) throws EnforcerRuleException
Description copied from class:AbstractBanDependencies
Checks the set of dependencies against the list of excludes.- Specified by:
checkDependencies
in classAbstractBanDependencies
- Parameters:
dependencies
- the dependencieslog
- the log- Returns:
- the sets the
- Throws:
EnforcerRuleException
- the enforcer rule exception
-
filterArtifacts
public java.util.Set<org.apache.maven.artifact.Artifact> filterArtifacts(java.util.Set<org.apache.maven.artifact.Artifact> dependencies)
-
isOnlyWhenRelease
public final boolean isOnlyWhenRelease()
-
setOnlyWhenRelease
public final void setOnlyWhenRelease(boolean onlyWhenRelease)
-
isFailWhenParentIsSnapshot
public final boolean isFailWhenParentIsSnapshot()
-
setFailWhenParentIsSnapshot
public final void setFailWhenParentIsSnapshot(boolean failWhenParentIsSnapshot)
-
setExcludes
public final void setExcludes(java.util.List<java.lang.String> excludes)
-
getExcludes
public final java.util.List<java.lang.String> getExcludes()
-
setIncludes
public void setIncludes(java.util.List<java.lang.String> includes)
-
getIncludes
public java.util.List<java.lang.String> getIncludes()
-
-