@Mojo(name="enforce", defaultPhase=VALIDATE, threadSafe=true) public class EnforceMojo extends AbstractEnforceMojo
Modifier and Type | Field and Description |
---|---|
protected static Hashtable<String,EnforcerRule> |
cache
This is a static variable used to persist the cached results across plugin invocations.
|
protected org.codehaus.plexus.PlexusContainer |
container |
protected boolean |
ignoreCache
Use this flag to disable rule result caching.
|
mojoExecution, project, session, skip, translator
Constructor and Description |
---|
EnforceMojo() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
protected String |
createRuleMessage(int i,
String currentRule,
EnforcerRuleException e)
Returns the error message displayed when failFast is set to false.
|
void |
execute()
Entry point to the mojo
|
EnforcerRule[] |
getRules() |
boolean |
isFail() |
boolean |
isFailFast() |
void |
setFail(boolean theFail) |
void |
setFailFast(boolean theFailFast) |
void |
setRules(EnforcerRule[] theRules) |
void |
setTranslator(org.apache.maven.project.path.PathTranslator theTranslator) |
protected boolean |
shouldExecute(EnforcerRule rule)
This method determines if a rule should execute based on the cache
|
getProject, getSession, getTranslator, isSkip, setProject, setSession, setSkip
@Parameter(property="enforcer.ignoreCache", defaultValue="false") protected boolean ignoreCache
protected static Hashtable<String,EnforcerRule> cache
protected org.codehaus.plexus.PlexusContainer container
public EnforceMojo()
public void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException
contextualize
in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
contextualize
in class AbstractEnforceMojo
org.codehaus.plexus.context.ContextException
public void execute() throws org.apache.maven.plugin.MojoExecutionException
execute
in interface org.apache.maven.plugin.Mojo
execute
in class AbstractEnforceMojo
org.apache.maven.plugin.MojoExecutionException
protected boolean shouldExecute(EnforcerRule rule)
shouldExecute
in class AbstractEnforceMojo
rule
- the rule to verifytrue
if rule should be executed, otherwise false
public boolean isFail()
isFail
in class AbstractEnforceMojo
public void setFail(boolean theFail)
theFail
- the fail to setpublic EnforcerRule[] getRules()
getRules
in class AbstractEnforceMojo
public void setRules(EnforcerRule[] theRules)
setRules
in class AbstractEnforceMojo
theRules
- the rules to setpublic void setFailFast(boolean theFailFast)
setFailFast
in class AbstractEnforceMojo
theFailFast
- the failFast to setpublic boolean isFailFast()
isFailFast
in class AbstractEnforceMojo
protected String createRuleMessage(int i, String currentRule, EnforcerRuleException e)
AbstractEnforceMojo
createRuleMessage
in class AbstractEnforceMojo
i
- indexcurrentRule
- name of the current rule.e
- rule exceptionpublic void setTranslator(org.apache.maven.project.path.PathTranslator theTranslator)
setTranslator
in class AbstractEnforceMojo
theTranslator
- the translator to setCopyright © 2007–2015 The Apache Software Foundation. All rights reserved.