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

public class EnforceMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

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

Version:
$Id: EnforceMojo.java 767320 2009-04-21 22:42:24Z bentmann $
Author:
Brian Fox

Field Summary
protected static java.util.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  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(org.codehaus.plexus.context.Context context)
           
 void execute()
          Entry point to the mojo
 org.apache.maven.project.MavenProject getProject()
           
 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(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
 
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


session

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


project

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


fail

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


skip

protected boolean skip
Flag to easily skip all checks


failFast

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


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.


cache

protected static java.util.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 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(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 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 Apache Software Foundation. All Rights Reserved.