Class BanPropertyPrefix
- 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.property.BanPropertyPrefix
-
- All Implemented Interfaces:
EnforcerRuleBase
@Named("banPropertyPrefix") public final class BanPropertyPrefix extends AbstractStandardEnforcerRuleThis rule checks that no Maven property starts with any of the configured banned prefixes and fails the build if one or more offending properties are found. Each prefix entry may also contain several prefixes separated by commas. This is useful to forbid properties that are reserved for other tooling or no longer supported.- Since:
- 3.7.0
- See Also:
- MENFORCER-433
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringMESSAGE_SEPARATORprivate static java.lang.StringPREFIX_SEPARATORprivate java.util.List<java.lang.String>prefixesList of prefixes that identify banned properties.private org.apache.maven.project.MavenProjectproject
-
Constructor Summary
Constructors Constructor Description BanPropertyPrefix(org.apache.maven.project.MavenProject project)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()This is the interface into the rule.java.util.List<java.lang.String>getPrefixes()(package private) static java.util.Set<java.lang.String>normalizePrefixes(java.util.List<java.lang.String> prefixes)voidsetPrefixes(java.util.List<java.lang.String> prefixes)java.lang.StringtoString()-
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel, getRuleName
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
-
-
-
Field Detail
-
PREFIX_SEPARATOR
private static final java.lang.String PREFIX_SEPARATOR
- See Also:
- Constant Field Values
-
MESSAGE_SEPARATOR
private static final java.lang.String MESSAGE_SEPARATOR
- See Also:
- Constant Field Values
-
prefixes
private java.util.List<java.lang.String> prefixes
List of prefixes that identify banned properties. Any project property whose name starts with one of these prefixes makes the rule fail. Each entry may also contain several prefixes separated by commas.
-
project
private final org.apache.maven.project.MavenProject project
-
-
Method Detail
-
setPrefixes
public void setPrefixes(java.util.List<java.lang.String> prefixes)
-
getPrefixes
public java.util.List<java.lang.String> getPrefixes()
-
execute
public void execute() throws EnforcerRuleExceptionDescription 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.- Specified by:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exceptionEnforcerRuleError- in order to brake a build immediately
-
normalizePrefixes
static java.util.Set<java.lang.String> normalizePrefixes(java.util.List<java.lang.String> prefixes)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-