Class ScopeArtifactFilter

java.lang.Object
org.apache.maven.shared.artifact.filter.ScopeArtifactFilter
All Implemented Interfaces:
org.apache.maven.artifact.resolver.filter.ArtifactFilter, StatisticsReportingArtifactFilter

public class ScopeArtifactFilter extends Object implements org.apache.maven.artifact.resolver.filter.ArtifactFilter, StatisticsReportingArtifactFilter

ArtifactFilter implementation that selects artifacts based on their scopes.

NOTE: None of the fine-grained scopes imply other scopes when enabled; when fine-grained scope control is used, each scope must be enabled separately, UNLESS the corresponding XXXWithImplications() method is used to enable that scope.
  • Constructor Details

    • ScopeArtifactFilter

      public ScopeArtifactFilter()
      Constructor that is meant to be used with fine-grained manipulation to enable/disable specific scopes using the associated mutator methods.
    • ScopeArtifactFilter

      public ScopeArtifactFilter(String scope)
      Constructor that uses the implied nature of Maven scopes to determine which artifacts to include. For instance, 'test' scope implies compile, provided, and runtime, while 'runtime' scope implies only compile.
      Parameters:
      scope - the scope
  • Method Details

    • include

      public boolean include(org.apache.maven.artifact.Artifact artifact)
      Specified by:
      include in interface org.apache.maven.artifact.resolver.filter.ArtifactFilter
    • toString

      public String toString()

      toString.

      Overrides:
      toString in class Object
      Returns:
      Information converted to a string.
    • reportFilteredArtifacts

      public void reportFilteredArtifacts(org.slf4j.Logger logger)

      reportFilteredArtifacts.

      Specified by:
      reportFilteredArtifacts in interface StatisticsReportingArtifactFilter
      Parameters:
      logger - the logger
    • reportMissedCriteria

      public void reportMissedCriteria(org.slf4j.Logger logger)

      reportMissedCriteria.

      Specified by:
      reportMissedCriteria in interface StatisticsReportingArtifactFilter
      Parameters:
      logger - the logger
    • hasMissedCriteria

      public boolean hasMissedCriteria()

      hasMissedCriteria.

      Specified by:
      hasMissedCriteria in interface StatisticsReportingArtifactFilter
      Returns:
      a boolean.
    • isIncludeCompileScope

      public boolean isIncludeCompileScope()

      isIncludeCompileScope.

      Returns:
      includeCompileScope
    • setIncludeCompileScope

      public ScopeArtifactFilter setIncludeCompileScope(boolean pIncludeCompileScope)

      Setter for the field includeCompileScope.

      Parameters:
      pIncludeCompileScope - true/false.
      Returns:
      ScopeArtifactFilter
    • isIncludeRuntimeScope

      public boolean isIncludeRuntimeScope()

      isIncludeRuntimeScope.

      Returns:
      includeRuntimeScope
    • setIncludeRuntimeScope

      public ScopeArtifactFilter setIncludeRuntimeScope(boolean pIncludeRuntimeScope)

      Setter for the field includeRuntimeScope.

      Parameters:
      pIncludeRuntimeScope - true/false
      Returns:
      ScopeArtifactFilter
    • isIncludeTestScope

      public boolean isIncludeTestScope()

      isIncludeTestScope.

      Returns:
      includeTestScope
    • setIncludeTestScope

      public ScopeArtifactFilter setIncludeTestScope(boolean pIncludeTestScope)

      Setter for the field includeTestScope.

      Parameters:
      pIncludeTestScope - includeTestScope
      Returns:
      ScopeArtifactFilter
    • isIncludeProvidedScope

      public boolean isIncludeProvidedScope()

      isIncludeProvidedScope.

      Returns:
      includeProvidedScope
    • setIncludeProvidedScope

      public ScopeArtifactFilter setIncludeProvidedScope(boolean pIncludeProvidedScope)

      Setter for the field includeProvidedScope.

      Parameters:
      pIncludeProvidedScope - yes/no.
      Returns:
      ScopeArtifactFilter()
    • isIncludeSystemScope

      public boolean isIncludeSystemScope()

      isIncludeSystemScope.

      Returns:
      includeSystemScope
    • setIncludeSystemScope

      public ScopeArtifactFilter setIncludeSystemScope(boolean pIncludeSystemScope)
      Parameters:
      pIncludeSystemScope - a boolean.
      Returns:
      a ScopeArtifactFilter object.
    • setIncludeCompileScopeWithImplications

      public ScopeArtifactFilter setIncludeCompileScopeWithImplications(boolean enabled)
      Manages the following scopes:
      • system
      • provided
      • compile
      Parameters:
      enabled - whether specified scopes should be included
      Returns:
      this instance
    • setIncludeRuntimeScopeWithImplications

      public ScopeArtifactFilter setIncludeRuntimeScopeWithImplications(boolean enabled)
      Manages the following scopes:
      • compile
      • runtime
      Parameters:
      enabled - whether specified scopes should be included
      Returns:
      this instance
    • setIncludeTestScopeWithImplications

      public ScopeArtifactFilter setIncludeTestScopeWithImplications(boolean enabled)
      Manages the following scopes:
      • system
      • provided
      • compile
      • runtime
      • test
      Parameters:
      enabled - whether specified scopes should be included
      Returns:
      this instance
    • setIncludeNullScope

      public ScopeArtifactFilter setIncludeNullScope(boolean enable)
      Determine whether artifacts that have a null scope are included or excluded.
      Parameters:
      enable - whether null-scope should be included
      Returns:
      this instance
    • reset

      public ScopeArtifactFilter reset()
      Reset hit counts and tracking of filtered artifacts, BUT NOT ENABLED SCOPES.
      Returns:
      this instance