@Mojo(name="enforce", defaultPhase=VALIDATE, requiresDependencyCollection=TEST, threadSafe=true) public class EnforceMojo extends 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 MojoExecution |
mojoExecution
MojoExecution needed by the ExpressionEvaluator
|
protected MavenProject |
project
POM
|
protected MavenSession |
session
The MavenSession
|
protected boolean |
skip
Flag to easily skip all checks
|
protected PathTranslator |
translator
Path Translator needed by the ExpressionEvaluator
|
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) |
void |
execute()
Entry point to the mojo
|
MavenProject |
getProject() |
EnforcerRule[] |
getRules() |
MavenSession |
getSession() |
PathTranslator |
getTranslator() |
boolean |
isFail() |
boolean |
isFailFast() |
boolean |
isSkip() |
void |
setFail(boolean theFail) |
void |
setFailFast(boolean theFailFast) |
void |
setProject(MavenProject theProject) |
void |
setRules(EnforcerRule[] theRules) |
void |
setSession(MavenSession theSession) |
void |
setSkip(boolean theSkip) |
void |
setTranslator(PathTranslator theTranslator) |
protected boolean |
shouldExecute(EnforcerRule rule)
This method determines if a rule should execute based on the cache
|
getLog, getPluginContext, setLog, setPluginContext
protected static Hashtable<String,EnforcerRule> cache
@Component(role=org.apache.maven.project.path.PathTranslator.class) protected PathTranslator translator
@Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected MojoExecution mojoExecution
@Parameter(defaultValue="${session}", readonly=true, required=true) protected MavenSession session
@Parameter(defaultValue="${project}", readonly=true, required=true) protected 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 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
org.codehaus.plexus.context.ContextException
public void execute() throws MojoExecutionException
execute
in interface Mojo
MojoExecutionException
protected boolean shouldExecute(EnforcerRule rule)
rule
- the rule to verifytrue
if rule should be executed, otherwise false
public boolean isFail()
public void setFail(boolean theFail)
theFail
- the fail to setpublic EnforcerRule[] getRules()
public void setRules(EnforcerRule[] theRules)
theRules
- the rules to setpublic void setFailFast(boolean theFailFast)
theFailFast
- the failFast to setpublic boolean isFailFast()
protected String createRuleMessage(int i, String currentRule, EnforcerRuleException e)
public void setTranslator(PathTranslator theTranslator)
theTranslator
- the translator to setpublic boolean isSkip()
public void setSkip(boolean theSkip)
theSkip
- the skip to setpublic MavenProject getProject()
public void setProject(MavenProject theProject)
theProject
- the project to setpublic MavenSession getSession()
public void setSession(MavenSession theSession)
theSession
- the session to setpublic PathTranslator getTranslator()
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.