Class RequireReleaseDeps

All Implemented Interfaces:
EnforcerRule, EnforcerRule2

public class RequireReleaseDeps extends AbstractBanDependencies
This rule checks that no snapshots are included.
Version:
$Id: RequireReleaseDeps.java 1697215 2015-08-23 16:27:17Z khmarbaise $
  • Field Details

    • 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 List<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 List<String> includes
      Dependencies to include when checking for release versions. If any of the included dependencies have snapshot versions, the rule will fail.
  • Constructor Details

    • RequireReleaseDeps

      public RequireReleaseDeps()
  • Method Details

    • execute

      public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
      Override parent to allow optional ignore of this rule.
      Specified by:
      execute in interface EnforcerRule
      Overrides:
      execute in class AbstractBanDependencies
      Parameters:
      helper - the enforcerRuleHelper
      Throws:
      EnforcerRuleException - when an exception occurs
    • getProject

      private org.apache.maven.project.MavenProject getProject(EnforcerRuleHelper helper) throws EnforcerRuleException
      Parameters:
      helper -
      Returns:
      The evaluated MavenProject.
      Throws:
      EnforcerRuleException
    • checkDependencies

      protected Set<org.apache.maven.artifact.Artifact> checkDependencies(Set<org.apache.maven.artifact.Artifact> dependencies, org.apache.maven.plugin.logging.Log log) throws EnforcerRuleException
      Checks the set of dependencies against the list of excludes.
      Specified by:
      checkDependencies in class AbstractBanDependencies
      Parameters:
      dependencies - the dependencies
      log - the log
      Returns:
      the sets the
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • filterArtifacts

      public Set<org.apache.maven.artifact.Artifact> filterArtifacts(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(List<String> excludes)
    • getExcludes

      public final List<String> getExcludes()
    • setIncludes

      public void setIncludes(List<String> includes)
    • getIncludes

      public List<String> getIncludes()