org.apache.maven.plugins.enforcer
Class BannedDependencies

java.lang.Object
  extended by org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
      extended by org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
          extended by org.apache.maven.plugins.enforcer.AbstractBanDependencies
              extended by org.apache.maven.plugins.enforcer.BannedDependencies
All Implemented Interfaces:
EnforcerRule

public class BannedDependencies
extends AbstractBanDependencies

This rule checks that lists of dependencies are not included.

Version:
$Id: BannedDependencies.java 675992 2008-07-11 15:42:48Z hboutemy $
Author:
Brian Fox

Field Summary
 java.util.List excludes
          Specify the banned dependencies.
 java.util.List includes
          Specify the allowed dependencies.
 
Fields inherited from class org.apache.maven.plugins.enforcer.AbstractBanDependencies
searchTransitive
 
Fields inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
message
 
Constructor Summary
BannedDependencies()
           
 
Method Summary
protected  java.util.Set checkDependencies(java.util.Set theDependencies, org.apache.maven.plugin.logging.Log log)
          Checks the set of dependencies against the list of excludes.
protected  boolean compareDependency(java.lang.String[] pattern, org.apache.maven.artifact.Artifact artifact)
          Compares the parsed array of substrings against the artifact.
 java.util.List getExcludes()
          Gets the excludes.
 java.util.List getIncludes()
          Gets the includes.
 void setExcludes(java.util.List theExcludes)
          Sets the excludes.
 void setIncludes(java.util.List theIncludes)
          Sets the includes.
 
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractBanDependencies
execute, getMessage, isSearchTransitive, setMessage, setSearchTransitive
 
Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

excludes

public java.util.List excludes
Specify the banned dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version]. Any of the sections can be a wildcard by using '*' (ie group:*:1.0)
The rule will fail if any dependency matches any exclude, unless it also matches an include rule.


includes

public java.util.List includes
Specify the allowed dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version]. Any of the sections can be a wildcard by using '*' (ie group:*:1.0)
Includes override the exclude rules. It is meant to allow wide exclusion rules with wildcards and still allow a smaller set of includes.
For example, to ban all xerces except xerces-api -> exclude "xerces", include "xerces:xerces-api"

Constructor Detail

BannedDependencies

public BannedDependencies()
Method Detail

checkDependencies

protected java.util.Set checkDependencies(java.util.Set theDependencies,
                                          org.apache.maven.plugin.logging.Log log)
                                   throws EnforcerRuleException
Description copied from class: AbstractBanDependencies
Checks the set of dependencies against the list of excludes.

Specified by:
checkDependencies in class AbstractBanDependencies
Parameters:
theDependencies - the dependencies
log - the log
Returns:
the sets the
Throws:
EnforcerRuleException - the enforcer rule exception

compareDependency

protected boolean compareDependency(java.lang.String[] pattern,
                                    org.apache.maven.artifact.Artifact artifact)
                             throws EnforcerRuleException
Compares the parsed array of substrings against the artifact.

Parameters:
pattern - the array of patterns
artifact - the artifact
Returns:
true if the artifact matches one of the patterns
Throws:
EnforcerRuleException - the enforcer rule exception

getExcludes

public java.util.List getExcludes()
Gets the excludes.

Returns:
the excludes

setExcludes

public void setExcludes(java.util.List theExcludes)
Sets the excludes.

Parameters:
theExcludes - the excludes to set

getIncludes

public java.util.List getIncludes()
Gets the includes.

Returns:
the includes

setIncludes

public void setIncludes(java.util.List theIncludes)
Sets the includes.

Parameters:
theIncludes - the includes to set


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