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- See Also:
AbstractDependencyMojo
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.artifact.handler.manager.ArtifactHandlerManagerartifactHandlerManagerprivate org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverartifactResolverprotected java.lang.StringclassifierSpecify classifier to look for.private org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverdependencyResolverprotected java.lang.StringexcludeArtifactIdsComma separated list of Artifact names to exclude.protected java.lang.StringexcludeClassifiersComma Separated list of Classifiers to exclude.protected java.lang.StringexcludeGroupIdsComma separated list of GroupId Names to exclude.protected java.lang.StringexcludeScopeScope to exclude.protected booleanexcludeTransitiveIf we should exclude transitive dependenciesprotected java.lang.StringexcludeTypesComma Separated list of Types to exclude.protected java.lang.StringincludeArtifactIdsComma separated list of Artifact names to include.protected java.lang.StringincludeClassifiersComma Separated list of Classifiers to include.protected java.lang.StringincludeGroupIdsComma separated list of GroupIds to include.protected java.lang.StringincludeScopeScope to include.protected java.lang.StringincludeTypesComma Separated list of Types to include.protected java.io.FilemarkersDirectoryDirectory to store flag filesprotected booleanoverWriteIfNewerOverwrite artifacts that don't exist or are older than the source.protected booleanoverWriteReleasesOverwrite release artifactsprotected booleanoverWriteSnapshotsOverwrite snapshot artifactsprotected booleanprependGroupIdPrepend the groupId during copy.private org.apache.maven.project.ProjectBuilderprojectBuilderprivate org.apache.maven.shared.transfer.repository.RepositoryManagerrepositoryManagerprotected java.lang.StringtypeSpecify type to look for when constructing artifact based on classifier.-
Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
outputAbsoluteArtifactFilename, reactorProjects, session
-
-
Constructor Summary
Constructors Constructor Description AbstractDependencyFilterMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private voidaddParentArtifacts(org.apache.maven.project.MavenProject project, java.util.Set<org.apache.maven.artifact.Artifact> artifacts)private org.apache.maven.project.MavenProjectbuildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact)protected DependencyStatusSetsfilterMarkedDependencies(java.util.Set<org.apache.maven.artifact.Artifact> artifacts)Filter the marked dependenciesprotected org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolvergetArtifactResolver()protected DependencyStatusSetsgetClassifierTranslatedDependencies(java.util.Set<org.apache.maven.artifact.Artifact> artifacts, boolean stopOnFailure)Transform artifactsprotected org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolvergetDependencyResolver()protected DependencyStatusSetsgetDependencySets(boolean stopOnFailure)protected DependencyStatusSetsgetDependencySets(boolean stopOnFailure, boolean includeParents)Method creates filters and filters the projects dependencies.protected abstract org.apache.maven.shared.artifact.filter.collection.ArtifactsFiltergetMarkedArtifactFilter()Return anArtifactsFilterindicating which artifacts must be filtered out.java.io.FilegetMarkersDirectory()protected org.apache.maven.shared.transfer.repository.RepositoryManagergetRepositoryManager()protected java.util.Set<org.apache.maven.artifact.Artifact>getResolvedDependencies(boolean stopOnFailure)Retrieves dependencies, either direct only or all including transitive.booleanisPrependGroupId()protected java.util.Set<org.apache.maven.artifact.Artifact>resolve(java.util.Set<org.apache.maven.shared.transfer.artifact.ArtifactCoordinate> coordinates, boolean stopOnFailure)voidsetMarkersDirectory(java.io.File theMarkersDirectory)voidsetPrependGroupId(boolean prependGroupId)-
Methods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
copyFile, doExecute, execute, getArchiverManager, getProject, isSilent, isSkip, isUseJvmChmod, newResolveArtifactProjectBuildingRequest, setArchiverManager, setSilent, setSkip, setUseJvmChmod, unpack, unpack, unpack
-
-
-
-
Field Detail
-
artifactResolver
@Component private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver artifactResolver
-
dependencyResolver
@Component private org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver dependencyResolver
-
repositoryManager
@Component private org.apache.maven.shared.transfer.repository.RepositoryManager repositoryManager
-
overWriteReleases
@Parameter(property="overWriteReleases", defaultValue="false") protected boolean overWriteReleasesOverwrite release artifacts- Since:
- 1.0
-
overWriteSnapshots
@Parameter(property="overWriteSnapshots", defaultValue="false") protected boolean overWriteSnapshotsOverwrite snapshot artifacts- Since:
- 1.0
-
overWriteIfNewer
@Parameter(property="overWriteIfNewer", defaultValue="true") protected boolean overWriteIfNewerOverwrite artifacts that don't exist or are older than the source.- Since:
- 2.0
-
excludeTransitive
@Parameter(property="excludeTransitive", defaultValue="false") protected boolean excludeTransitiveIf we should exclude transitive dependencies- Since:
- 2.0
-
includeTypes
@Parameter(property="includeTypes", defaultValue="") protected java.lang.String includeTypesComma Separated list of Types to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeTypes
@Parameter(property="excludeTypes", defaultValue="") protected java.lang.String excludeTypesComma Separated list of Types to exclude. Empty String indicates don't exclude anything (default).- Since:
- 2.0
-
includeScope
@Parameter(property="includeScope", defaultValue="") protected java.lang.String includeScopeScope to include. An Empty string indicates all scopes (default). The scopes being interpreted are the scopes as Maven sees them, not as specified in the pom. In summary:runtimescope gives runtime and compile dependencies,compilescope gives compile, provided, and system dependencies,test(default) scope gives all dependencies,providedscope just gives provided dependencies,systemscope just gives system dependencies.
- Since:
- 2.0
-
excludeScope
@Parameter(property="excludeScope", defaultValue="") protected java.lang.String excludeScopeScope to exclude. An Empty string indicates no scopes (default).- Since:
- 2.0
-
includeClassifiers
@Parameter(property="includeClassifiers", defaultValue="") protected java.lang.String includeClassifiersComma Separated list of Classifiers to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeClassifiers
@Parameter(property="excludeClassifiers", defaultValue="") protected java.lang.String excludeClassifiersComma Separated list of Classifiers to exclude. Empty String indicates don't exclude anything (default).- Since:
- 2.0
-
classifier
@Parameter(property="classifier", defaultValue="") protected java.lang.String classifierSpecify classifier to look for. Example: sources- Since:
- 2.0
-
type
@Parameter(property="type", defaultValue="") protected java.lang.String typeSpecify type to look for when constructing artifact based on classifier. Example: java-source,jar,war- Since:
- 2.0
-
excludeArtifactIds
@Parameter(property="excludeArtifactIds", defaultValue="") protected java.lang.String excludeArtifactIdsComma separated list of Artifact names to exclude.- Since:
- 2.0
-
includeArtifactIds
@Parameter(property="includeArtifactIds", defaultValue="") protected java.lang.String includeArtifactIdsComma separated list of Artifact names to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeGroupIds
@Parameter(property="excludeGroupIds", defaultValue="") protected java.lang.String excludeGroupIdsComma separated list of GroupId Names to exclude.- Since:
- 2.0
-
includeGroupIds
@Parameter(property="includeGroupIds", defaultValue="") protected java.lang.String includeGroupIdsComma 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 java.io.File markersDirectoryDirectory to store flag files- Since:
- 2.0
-
prependGroupId
@Parameter(property="mdep.prependGroupId", defaultValue="false") protected boolean prependGroupIdPrepend the groupId during copy.- Since:
- 2.2
-
projectBuilder
@Component private org.apache.maven.project.ProjectBuilder projectBuilder
-
artifactHandlerManager
@Component private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
-
-
Method Detail
-
getMarkedArtifactFilter
protected abstract org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
Return anArtifactsFilterindicating which artifacts must be filtered out.- Returns:
- an
ArtifactsFilterindicating which artifacts must be filtered out.
-
getResolvedDependencies
protected java.util.Set<org.apache.maven.artifact.Artifact> getResolvedDependencies(boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionExceptionRetrieves 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-trueif parents should be included or notfalse.- Returns:
- DependencyStatusSets - Bean of TreeSets that contains information on the projects dependencies
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of errors.
-
buildProjectFromArtifact
private org.apache.maven.project.MavenProject buildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addParentArtifacts
private void addParentArtifacts(org.apache.maven.project.MavenProject project, java.util.Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassifierTranslatedDependencies
protected DependencyStatusSets getClassifierTranslatedDependencies(java.util.Set<org.apache.maven.artifact.Artifact> artifacts, boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionException
Transform artifacts- Parameters:
artifacts- set of artifactsArtifact.stopOnFailure- true/false.- Returns:
- DependencyStatusSets - Bean of TreeSets that contains information on the projects dependencies
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
filterMarkedDependencies
protected DependencyStatusSets filterMarkedDependencies(java.util.Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
Filter the marked dependencies- Parameters:
artifacts- The artifacts setArtifact.- Returns:
- status set
DependencyStatusSets. - Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
resolve
protected java.util.Set<org.apache.maven.artifact.Artifact> resolve(java.util.Set<org.apache.maven.shared.transfer.artifact.ArtifactCoordinate> coordinates, boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionException- Parameters:
coordinates- The set of artifact coordinatesArtifactCoordinate.stopOnFailure-trueif we should fail with exception if an artifact couldn't be resolvedfalseotherwise.- Returns:
- the resolved artifacts.
Artifact. - Throws:
org.apache.maven.plugin.MojoExecutionException- in case of error.
-
getMarkersDirectory
public java.io.File getMarkersDirectory()
- Returns:
- Returns the markersDirectory.
-
setMarkersDirectory
public void setMarkersDirectory(java.io.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.
-
getArtifactResolver
protected final org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver getArtifactResolver()
- Returns:
artifactResolver
-
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
-
-