Class AbstractDependencyFilterMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.dependency.AbstractDependencyMojo
org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractFromDependenciesMojo, AbstractResolveMojo, BuildClasspathMojo

public abstract class AbstractDependencyFilterMojo extends AbstractDependencyMojo
Class that encapsulates the plugin parameters, and contains methods that handle dependency filtering
Author:
Brian Fox
See Also:
  • Field Details

    • overWriteReleases

      @Parameter(property="overWriteReleases", defaultValue="false") protected boolean overWriteReleases
      Overwrite release artifacts
      Since:
      1.0
    • overWriteSnapshots

      @Parameter(property="overWriteSnapshots", defaultValue="false") protected boolean overWriteSnapshots
      Overwrite snapshot artifacts
      Since:
      1.0
    • overWriteIfNewer

      @Parameter(property="overWriteIfNewer", defaultValue="true") protected boolean overWriteIfNewer
      Overwrite artifacts that don't exist or are older than the source.
      Since:
      2.0
    • excludeTransitive

      @Parameter(property="excludeTransitive", defaultValue="false") protected boolean excludeTransitive
      If we should exclude transitive dependencies
      Since:
      2.0
    • includeTypes

      @Parameter(property="includeTypes", defaultValue="") protected String includeTypes
      Comma Separated list of Types to include. Empty String indicates include everything (default).
      Since:
      2.0
    • excludeTypes

      @Parameter(property="excludeTypes", defaultValue="") protected String excludeTypes
      Comma Separated list of Types to exclude. Empty String indicates don't exclude anything (default).
      Since:
      2.0
    • includeScope

      @Parameter(property="includeScope", defaultValue="") protected String includeScope
      Scope threshold to include. An empty string indicates include all dependencies (default).
      The scope threshold value being interpreted is the scope as Maven filters for creating a classpath, not as specified in the pom. In summary:
      • runtime include scope gives runtime and compile dependencies,
      • compile include scope gives compile, provided, and system dependencies,
      • test include scope gives all dependencies (equivalent to default),
      • provided include scope just gives provided dependencies,
      • system include scope just gives system dependencies.
      Since:
      2.0
    • excludeScope

      @Parameter(property="excludeScope", defaultValue="") protected String excludeScope
      Scope threshold to exclude, if no value is defined for include. An empty string indicates no dependencies (default).
      The scope threshold value being interpreted is the scope as Maven filters for creating a classpath, not as specified in the pom. In summary:
      • runtime exclude scope excludes runtime and compile dependencies,
      • compile exclude scope excludes compile, provided, and system dependencies,
      • test exclude scope excludes all dependencies, then not really a legitimate option: it will fail, you probably meant to configure includeScope = compile
      • provided exclude scope just excludes provided dependencies,
      • system exclude scope just excludes system dependencies.
      Since:
      2.0
    • includeClassifiers

      @Parameter(property="includeClassifiers", defaultValue="") protected String includeClassifiers
      Comma Separated list of Classifiers to include. Empty String indicates include everything (default).
      Since:
      2.0
    • excludeClassifiers

      @Parameter(property="excludeClassifiers", defaultValue="") protected String excludeClassifiers
      Comma Separated list of Classifiers to exclude. Empty String indicates don't exclude anything (default).
      Since:
      2.0
    • classifier

      @Parameter(property="classifier", defaultValue="") protected String classifier
      Specify classifier to look for. Example: sources
      Since:
      2.0
    • type

      @Parameter(property="type", defaultValue="") protected String type
      Specify type to look for when constructing artifact based on classifier. Example: java-source,jar,war
      Since:
      2.0
    • excludeArtifactIds

      @Parameter(property="excludeArtifactIds", defaultValue="") protected String excludeArtifactIds
      Comma separated list of Artifact names to exclude.
      Since:
      2.0
    • includeArtifactIds

      @Parameter(property="includeArtifactIds", defaultValue="") protected String includeArtifactIds
      Comma separated list of Artifact names to include. Empty String indicates include everything (default).
      Since:
      2.0
    • excludeGroupIds

      @Parameter(property="excludeGroupIds", defaultValue="") protected String excludeGroupIds
      Comma separated list of GroupId Names to exclude.
      Since:
      2.0
    • includeGroupIds

      @Parameter(property="includeGroupIds", defaultValue="") protected String includeGroupIds
      Comma separated list of GroupIds to include. Empty String indicates include everything (default).
      Since:
      2.0
    • markersDirectory

      @Parameter(property="markersDirectory", defaultValue="${project.build.directory}/dependency-maven-plugin-markers") protected File markersDirectory
      Directory to store flag files
      Since:
      2.0
    • prependGroupId

      @Parameter(property="mdep.prependGroupId", defaultValue="false") protected boolean prependGroupId
      Prepend the groupId during copy.
      Since:
      2.2
  • Constructor Details

    • AbstractDependencyFilterMojo

      public AbstractDependencyFilterMojo()
  • Method Details

    • getMarkedArtifactFilter

      protected abstract org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
      Return an ArtifactsFilter indicating which artifacts must be filtered out.
      Returns:
      an ArtifactsFilter indicating which artifacts must be filtered out.
    • getResolvedDependencies

      protected Set<org.apache.maven.artifact.Artifact> getResolvedDependencies(boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionException
      Retrieves dependencies, either direct only or all including transitive.
      Parameters:
      stopOnFailure - true to fail if resolution does not work or false not to fail.
      Returns:
      A set of artifacts
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of errors.
    • getDependencySets

      protected DependencyStatusSets getDependencySets(boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      stopOnFailure - true/false.
      Returns:
      DependencyStatusSets
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of an error.
    • getDependencySets

      protected DependencyStatusSets getDependencySets(boolean stopOnFailure, boolean includeParents) throws org.apache.maven.plugin.MojoExecutionException
      Method creates filters and filters the projects dependencies. This method also transforms the dependencies if classifier is set. The dependencies are filtered in least specific to most specific order
      Parameters:
      stopOnFailure - true to fail if artifacts can't be resolved false otherwise.
      includeParents - true if parents should be included or not false.
      Returns:
      DependencyStatusSets - Bean of TreeSets that contains information on the projects dependencies
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of errors.
    • filterMarkedDependencies

      protected DependencyStatusSets filterMarkedDependencies(Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
      Filter the marked dependencies
      Parameters:
      artifacts - The artifacts set Artifact.
      Returns:
      status set DependencyStatusSets.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of an error.
    • getMarkersDirectory

      public File getMarkersDirectory()
      Returns:
      Returns the markersDirectory.
    • setMarkersDirectory

      public void setMarkersDirectory(File theMarkersDirectory)
      Parameters:
      theMarkersDirectory - The markersDirectory to set.
    • isPrependGroupId

      public boolean isPrependGroupId()
      Returns:
      true, if the groupId should be prepended to the filename.
    • setPrependGroupId

      public void setPrependGroupId(boolean prependGroupId)
      Parameters:
      prependGroupId - - true if the groupId must be prepended during the copy.
    • getResolverUtil

      protected final ResolverUtil getResolverUtil()
      Returns:
      resolverUtil
    • getDependencyResolver

      protected final org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver getDependencyResolver()
      Returns:
      dependencyResolver
    • getRepositoryManager

      protected final org.apache.maven.shared.transfer.repository.RepositoryManager getRepositoryManager()
      Returns:
      repositoryManager