Class RequireReleaseDeps
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.dependency.BannedDependenciesBase
org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps
- All Implemented Interfaces:
EnforcerRuleBase
This rule checks that no snapshots are included.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanAllows this rule to fail when the parent is defined as a snapshot.private booleanAllows this rule to execute only when this project is a release. -
Constructor Summary
ConstructorsConstructorDescriptionRequireReleaseDeps(org.apache.maven.execution.MavenSession session, ResolverUtil resolverUtil) -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This is the interface into the rule.private Set<org.apache.maven.artifact.Artifact> filterArtifacts(Set<org.apache.maven.artifact.Artifact> dependencies) Filter the dependency artifacts according to the includes and excludes If includes and excludes are both null, the original set is returned.protected StringvoidsetFailWhenParentIsSnapshot(boolean failWhenParentIsSnapshot) voidsetOnlyWhenRelease(boolean onlyWhenRelease) toString()protected booleanvalidate(org.apache.maven.artifact.Artifact artifact) Validates a dependency artifact if it fulfills the enforcer ruleMethods inherited from class org.apache.maven.enforcer.rules.dependency.BannedDependenciesBase
getExcludes, getIncludes, getSession, isSearchTransitive, setExcludes, setIncludes, setSearchTransitive, validateMethods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevelMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
onlyWhenRelease
private boolean onlyWhenReleaseAllows this rule to execute only when this project is a release. -
failWhenParentIsSnapshot
private boolean failWhenParentIsSnapshotAllows this rule to fail when the parent is defined as a snapshot.
-
-
Constructor Details
-
RequireReleaseDeps
@Inject public RequireReleaseDeps(org.apache.maven.execution.MavenSession session, ResolverUtil resolverUtil)
-
-
Method Details
-
execute
Description copied from class:AbstractEnforcerRuleThis 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.- Overrides:
executein classBannedDependenciesBase- Throws:
EnforcerRuleException- the enforcer rule exception
-
getErrorMessage
- Specified by:
getErrorMessagein classBannedDependenciesBase
-
validate
protected boolean validate(org.apache.maven.artifact.Artifact artifact) Description copied from class:BannedDependenciesBaseValidates a dependency artifact if it fulfills the enforcer rule- Specified by:
validatein classBannedDependenciesBase- Parameters:
artifact- dependency to be checked against the list of excludes- Returns:
trueif the dependency passes the rule,falseif the dependency triggers a validation error
-
filterArtifacts
private Set<org.apache.maven.artifact.Artifact> filterArtifacts(Set<org.apache.maven.artifact.Artifact> dependencies) throws EnforcerRuleException Filter the dependency artifacts according to the includes and excludes If includes and excludes are both null, the original set is returned.- Parameters:
dependencies- the list of dependencies to filter- Returns:
- the resulting set of dependencies
- Throws:
EnforcerRuleException
-
setOnlyWhenRelease
public void setOnlyWhenRelease(boolean onlyWhenRelease) -
setFailWhenParentIsSnapshot
public void setFailWhenParentIsSnapshot(boolean failWhenParentIsSnapshot) -
toString
-