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:
ContextEnabled, Mojo, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Direct Known Subclasses:
EnforceOnceMojo

public class EnforceMojo
extends AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.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  org.codehaus.plexus.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  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
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
EnforceMojo()
           
 
Method Summary
 void contextualize(org.codehaus.plexus.context.Context context)
           
 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
 
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 PathTranslator translator
Path Translator needed by the ExpressionEvaluator

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

session

protected MavenSession session
The MavenSession

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

project

protected 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 org.codehaus.plexus.PlexusContainer container
Constructor Detail

EnforceMojo

public EnforceMojo()
Method Detail

contextualize

public void contextualize(org.codehaus.plexus.context.Context context)
                   throws org.codehaus.plexus.context.ContextException
Specified by:
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Throws:
org.codehaus.plexus.context.ContextException

execute

public void execute()
             throws MojoExecutionException
Entry point to the mojo

Specified by:
execute in interface Mojo
Throws:
MojoExecutionException

shouldExecute

protected boolean shouldExecute(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 EnforcerRule[] getRules()
Returns:
the rules

setRules

public void setRules(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 MavenProject getProject()
Returns:
the project

setProject

public void setProject(MavenProject theProject)
Parameters:
theProject - the project to set

getSession

public MavenSession getSession()
Returns:
the session

setSession

public void setSession(MavenSession theSession)
Parameters:
theSession - the session to set

getTranslator

public PathTranslator getTranslator()
Returns:
the translator

setTranslator

public void setTranslator(PathTranslator theTranslator)
Parameters:
theTranslator - the translator to set


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