org.apache.maven.plugin.enforcer
Class RequirePluginVersions

java.lang.Object
  extended by org.apache.maven.plugin.enforcer.RequirePluginVersions
All Implemented Interfaces:
org.apache.maven.shared.enforcer.rule.api.EnforcerRule

public class RequirePluginVersions
extends Object
implements org.apache.maven.shared.enforcer.rule.api.EnforcerRule

Version:
$Id$ This rule will enforce that all plugins specified in the poms have a version declared.
Author:
Brian Fox

Field Summary
 boolean banLatest
          The message to be printed in case the condition returns true
 boolean banRelease
          The message to be printed in case the condition returns true
 String message
          The message to be printed in case the condition returns true
 
Constructor Summary
RequirePluginVersions()
           
 
Method Summary
protected  boolean checkIfModelMatches(String groupId, String artifactId, String version, org.apache.maven.model.Model model)
           
 void execute(org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper helper)
           
protected  List getAllPluginEntries(org.apache.maven.project.MavenProject project)
          Gets all plugin entries in build.plugins or build.pluginManagement.plugins in this project and all parents
protected  String getMessage()
           
protected  List getModelsRecursively(String groupId, String artifactId, String version, File pom)
          This method loops through all the parents, getting each pom model and then its parent.
 Map getPhaseToLifecycleMap()
           
protected  boolean hasVersionSpecified(org.apache.maven.model.Plugin source, List plugins)
           
protected  boolean isBanLatest()
           
protected  boolean isBanRelease()
           
protected  void setBanLatest(boolean theBanLatest)
           
protected  void setBanRelease(boolean theBanRelease)
           
protected  void setMessage(String theMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

public String message
The message to be printed in case the condition returns true


banLatest

public boolean banLatest
The message to be printed in case the condition returns true


banRelease

public boolean banRelease
The message to be printed in case the condition returns true

Constructor Detail

RequirePluginVersions

public RequirePluginVersions()
Method Detail

execute

public void execute(org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper helper)
             throws org.apache.maven.shared.enforcer.rule.api.EnforcerRuleException
Specified by:
execute in interface org.apache.maven.shared.enforcer.rule.api.EnforcerRule
Throws:
org.apache.maven.shared.enforcer.rule.api.EnforcerRuleException

hasVersionSpecified

protected boolean hasVersionSpecified(org.apache.maven.model.Plugin source,
                                      List plugins)

getPhaseToLifecycleMap

public Map getPhaseToLifecycleMap()
                           throws org.apache.maven.lifecycle.LifecycleExecutionException
Throws:
org.apache.maven.lifecycle.LifecycleExecutionException

getModelsRecursively

protected List getModelsRecursively(String groupId,
                                    String artifactId,
                                    String version,
                                    File pom)
                             throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                    org.apache.maven.artifact.resolver.ArtifactNotFoundException,
                                    IOException,
                                    org.codehaus.plexus.util.xml.pull.XmlPullParserException
This method loops through all the parents, getting each pom model and then its parent.

Parameters:
groupId -
artifactId -
version -
Returns:
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException

getAllPluginEntries

protected List getAllPluginEntries(org.apache.maven.project.MavenProject project)
                            throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                   org.apache.maven.artifact.resolver.ArtifactNotFoundException,
                                   IOException,
                                   org.codehaus.plexus.util.xml.pull.XmlPullParserException
Gets all plugin entries in build.plugins or build.pluginManagement.plugins in this project and all parents

Parameters:
project -
Returns:
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException

checkIfModelMatches

protected boolean checkIfModelMatches(String groupId,
                                      String artifactId,
                                      String version,
                                      org.apache.maven.model.Model model)

isBanLatest

protected boolean isBanLatest()
Returns:
the banLatest

setBanLatest

protected void setBanLatest(boolean theBanLatest)
Parameters:
theBanLatest - the banLatest to set

isBanRelease

protected boolean isBanRelease()
Returns:
the banRelease

setBanRelease

protected void setBanRelease(boolean theBanRelease)
Parameters:
theBanRelease - the banRelease to set

getMessage

protected String getMessage()
Returns:
the message

setMessage

protected void setMessage(String theMessage)
Parameters:
theMessage - the message to set


Copyright © 2002-2007 Apache Software Foundation. All Rights Reserved.