Class RequireFilesSize
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.files.AbstractRequireFiles
org.apache.maven.enforcer.rules.files.RequireFilesSize
- All Implemented Interfaces:
EnforcerRuleBase
Rule to validate the main artifact is within certain size constraints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe error msg.private longthe max size allowed.private static final longprivate longthe min size allowed.private final org.apache.maven.project.MavenProjectprivate booleanthe mode for computing the size when the files are directories. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanCheck one file.private longcomputeLength(File file) voidexecute()This is the interface into the rule.If the rule is to be cached during session scope, whole executing of Maven build, this id is used as part of the key.(package private) StringGets the error msg.voidsetMaxsize(long maxsize) voidsetMinsize(long minsize) voidsetRecursive(boolean recursive) Methods inherited from class AbstractRequireFiles
getFiles, setAllowNulls, setFilesList, setSatisfyAny, toStringMethods inherited from class AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class AbstractEnforcerRule
getLevel, getRuleNameMethods inherited from class AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
MAXSIZE
private static final long MAXSIZE- See Also:
-
maxsize
private long maxsizethe max size allowed. -
minsize
private long minsizethe min size allowed. -
recursive
private boolean recursivethe mode for computing the size when the files are directories. -
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
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 classAbstractRequireFiles- Throws:
EnforcerRuleException- the enforcer rule exception
-
getCacheId
Description copied from class:AbstractEnforcerRuleIf 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:
getCacheIdin classAbstractRequireFiles- Returns:
- id to be used by the Enforcer to determine uniqueness of cache results.
Return
nulldisable cache of rule executing.
-
checkFile
Description copied from class:AbstractRequireFilesCheck one file.- Specified by:
checkFilein classAbstractRequireFiles- Parameters:
file- the file- Returns:
trueif successful
-
computeLength
-
getErrorMsg
String getErrorMsg()Description copied from class:AbstractRequireFilesGets the error msg.- Specified by:
getErrorMsgin classAbstractRequireFiles- Returns:
- the error msg
-
setMaxsize
public void setMaxsize(long maxsize) -
setMinsize
public void setMinsize(long minsize) -
setRecursive
public void setRecursive(boolean recursive)
-