public abstract class AbstractEnforceMojo extends org.apache.maven.plugin.AbstractMojo implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
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.
|
protected org.apache.maven.plugin.MojoExecution |
mojoExecution
MojoExecution needed by the ExpressionEvaluator
|
protected org.apache.maven.project.MavenProject |
project
POM
|
protected org.apache.maven.execution.MavenSession |
session
The MavenSession
|
protected boolean |
skip
Flag to easily skip all checks
|
protected org.apache.maven.project.path.PathTranslator |
translator
Path Translator needed by the ExpressionEvaluator
|
Constructor and Description |
---|
AbstractEnforceMojo() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
protected abstract 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
|
org.apache.maven.project.MavenProject |
getProject() |
abstract EnforcerRule[] |
getRules() |
org.apache.maven.execution.MavenSession |
getSession() |
org.apache.maven.project.path.PathTranslator |
getTranslator() |
abstract boolean |
isFail() |
abstract boolean |
isFailFast() |
boolean |
isSkip() |
abstract void |
setFailFast(boolean failFast) |
void |
setProject(org.apache.maven.project.MavenProject theProject) |
abstract void |
setRules(EnforcerRule[] theRules) |
void |
setSession(org.apache.maven.execution.MavenSession theSession) |
void |
setSkip(boolean theSkip) |
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
|
protected static Hashtable<String,EnforcerRule> cache
@Component(role=org.apache.maven.project.path.PathTranslator.class) protected org.apache.maven.project.path.PathTranslator translator
@Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected org.apache.maven.plugin.MojoExecution mojoExecution
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
@Parameter(property="enforcer.skip", defaultValue="false") protected boolean skip
@Parameter(property="enforcer.ignoreCache", defaultValue="false") protected boolean ignoreCache
protected org.codehaus.plexus.PlexusContainer container
public AbstractEnforceMojo()
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
org.codehaus.plexus.context.ContextException
public void execute() throws org.apache.maven.plugin.MojoExecutionException
execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
protected boolean shouldExecute(EnforcerRule rule)
rule
- the rule to verifytrue
if rule should be executed, otherwise false
public abstract boolean isFail()
public abstract EnforcerRule[] getRules()
public abstract void setRules(EnforcerRule[] theRules)
theRules
- to set.public boolean isSkip()
public void setSkip(boolean theSkip)
theSkip
- the skip to setpublic abstract boolean isFailFast()
public abstract void setFailFast(boolean failFast)
failFast
- to setpublic org.apache.maven.project.MavenProject getProject()
public void setProject(org.apache.maven.project.MavenProject theProject)
theProject
- the project to setpublic org.apache.maven.execution.MavenSession getSession()
public void setSession(org.apache.maven.execution.MavenSession theSession)
theSession
- the session to setpublic org.apache.maven.project.path.PathTranslator getTranslator()
public void setTranslator(org.apache.maven.project.path.PathTranslator theTranslator)
theTranslator
- the translator to setprotected abstract String createRuleMessage(int i, String currentRule, EnforcerRuleException e)
i
- indexcurrentRule
- name of the current rule.e
- rule exceptionCopyright © 2007–2015 The Apache Software Foundation. All rights reserved.