org.apache.maven.plugins.enforcer
Class EnforceMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugins.enforcer.EnforceMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Contextualizable
Direct Known Subclasses:
EnforceOnceMojo

public class EnforceMojo
extends org.apache.maven.plugin.AbstractMojo
implements Contextualizable

This goal executes the defined enforcer-rules once per module.

Version:
$Id: EnforceMojo.java 1127643 2011-05-25 19:24:38Z krosenvold $
Author:
Brian Fox
Is defined by the goal name:
enforce
Is bound to the specified phase of the standard build lifecycle:
validate
Requires the dependencies in this specified scope:
test
Mojo is thread safe:
true

Field Summary
protected static Hashtable cache
          This is a static variable used to persist the cached results across plugin invocations.
protected  PlexusContainer container
           
protected  boolean fail
          Flag to fail the build if a version check fails.
protected  boolean failFast
          Fail on the first rule that doesn't pass
protected  boolean ignoreCache
          Use this flag to disable rule result caching.
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
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
EnforceMojo()
           
 
Method Summary
 void contextualize(Context context)
           
 void execute()
          Entry point to the mojo
 org.apache.maven.project.MavenProject getProject()
           
 org.apache.maven.enforcer.rule.api.EnforcerRule[] getRules()
           
 org.apache.maven.execution.MavenSession getSession()
           
 org.apache.maven.project.path.PathTranslator getTranslator()
           
 boolean isFail()
           
 boolean isFailFast()
           
 boolean isSkip()
           
 void setFail(boolean theFail)
           
 void setFailFast(boolean theFailFast)
           
 void setProject(org.apache.maven.project.MavenProject theProject)
           
 void setRules(org.apache.maven.enforcer.rule.api.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(org.apache.maven.enforcer.rule.api.EnforcerRule rule)
          This method determines if a rule should execute based on the cache
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

translator

protected org.apache.maven.project.path.PathTranslator translator
Path Translator needed by the ExpressionEvaluator

Is a Plexus component defined by:
role:
org.apache.maven.project.path.PathTranslator

session

protected org.apache.maven.execution.MavenSession session
The MavenSession

Is defined by:
expression:
${session}
Is readonly.

project

protected org.apache.maven.project.MavenProject project
POM

Is defined by:
expression:
${project}
Is readonly.
Is required.

fail

protected boolean fail
Flag to fail the build if a version check fails.

Is defined by:
expression:
${enforcer.fail}
default-value:
true

skip

protected boolean skip
Flag to easily skip all checks

Is defined by:
expression:
${enforcer.skip}
default-value:
false

failFast

protected boolean failFast
Fail on the first rule that doesn't pass

Is defined by:
expression:
${enforcer.failFast}
default-value:
false

ignoreCache

protected boolean ignoreCache
Use this flag to disable rule result caching. This will cause all rules to execute on each project even if the rule indicates it can safely be cached.

Is defined by:
expression:
${enforcer.ignoreCache}
default-value:
false

cache

protected static Hashtable cache
This is a static variable used to persist the cached results across plugin invocations.


container

protected PlexusContainer container
Constructor Detail

EnforceMojo

public EnforceMojo()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Entry point to the mojo

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException

shouldExecute

protected boolean shouldExecute(org.apache.maven.enforcer.rule.api.EnforcerRule rule)
This method determines if a rule should execute based on the cache

Parameters:
rule -
Returns:

isFail

public boolean isFail()
Returns:
the fail

setFail

public void setFail(boolean theFail)
Parameters:
theFail - the fail to set

getRules

public org.apache.maven.enforcer.rule.api.EnforcerRule[] getRules()
Returns:
the rules

setRules

public void setRules(org.apache.maven.enforcer.rule.api.EnforcerRule[] theRules)
Parameters:
theRules - the rules to set

isSkip

public boolean isSkip()
Returns:
the skip

setSkip

public void setSkip(boolean theSkip)
Parameters:
theSkip - the skip to set

isFailFast

public boolean isFailFast()
Returns:
the failFast

setFailFast

public void setFailFast(boolean theFailFast)
Parameters:
theFailFast - the failFast to set

getProject

public org.apache.maven.project.MavenProject getProject()
Returns:
the project

setProject

public void setProject(org.apache.maven.project.MavenProject theProject)
Parameters:
theProject - the project to set

getSession

public org.apache.maven.execution.MavenSession getSession()
Returns:
the session

setSession

public void setSession(org.apache.maven.execution.MavenSession theSession)
Parameters:
theSession - the session to set

getTranslator

public org.apache.maven.project.path.PathTranslator getTranslator()
Returns:
the translator

setTranslator

public void setTranslator(org.apache.maven.project.path.PathTranslator theTranslator)
Parameters:
theTranslator - the translator to set


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.