Class RequireFilesSize

All Implemented Interfaces:
EnforcerRuleBase

@Named("requireFilesSize") public final class RequireFilesSize extends AbstractRequireFiles
Rule to validate the main artifact is within certain size constraints.
  • Field Details

    • MAXSIZE

      private static final long MAXSIZE
      See Also:
    • maxsize

      private long maxsize
      the max size allowed.
    • minsize

      private long minsize
      the min size allowed.
    • errorMsg

      private String errorMsg
      The error msg.
    • project

      private final org.apache.maven.project.MavenProject project
  • Constructor Details

    • RequireFilesSize

      @Inject public RequireFilesSize(org.apache.maven.project.MavenProject project)
  • Method Details

    • execute

      public void execute() throws EnforcerRuleException
      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.
      Overrides:
      execute in class AbstractRequireFiles
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • getCacheId

      public String getCacheId()
      Description copied from class: AbstractEnforcerRule
      If the rule is to be cached during session scope, whole executing of Maven build, this id is used as part of the key.

      Rule of the same class and the same cache id will be executed once.

      Overrides:
      getCacheId in class AbstractRequireFiles
      Returns:
      id to be used by the Enforcer to determine uniqueness of cache results. Return null disable cache of rule executing.
    • checkFile

      boolean checkFile(File file)
      Description copied from class: AbstractRequireFiles
      Check one file.
      Specified by:
      checkFile in class AbstractRequireFiles
      Parameters:
      file - the file
      Returns:
      true if successful
    • getErrorMsg

      String getErrorMsg()
      Description copied from class: AbstractRequireFiles
      Gets the error msg.
      Specified by:
      getErrorMsg in class AbstractRequireFiles
      Returns:
      the error msg
    • setMaxsize

      public void setMaxsize(long maxsize)
    • setMinsize

      public void setMinsize(long minsize)