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
Class that encapsulates the plugin parameters, and contains methods that handle dependency filtering
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.artifact.handler.manager.ArtifactHandlerManagerprotected StringSpecify classifier to look for.private org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverprotected StringComma separated list of Artifact names to exclude.protected StringComma Separated list of Classifiers to exclude.protected StringComma separated list of GroupId Names to exclude.protected StringScope threshold to exclude, if no value is defined for include.protected booleanIf we should exclude transitive dependenciesprotected StringComma Separated list of Types to exclude.protected StringComma separated list of Artifact names to include.protected StringComma Separated list of Classifiers to include.protected StringComma separated list of GroupIds to include.protected StringScope threshold to include.protected StringComma Separated list of Types to include.protected FileDirectory to store flag filesprotected booleanOverwrite artifacts that don't exist or are older than the source.protected booleanOverwrite release artifactsprotected booleanOverwrite snapshot artifactsprotected booleanPrepend the groupId during copy.private org.apache.maven.project.ProjectBuilderprivate org.apache.maven.shared.transfer.repository.RepositoryManagerprivate ResolverUtilprotected StringSpecify type to look for when constructing artifact based on classifier.Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
reactorProjects, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddParentArtifacts(org.apache.maven.project.MavenProject project, Set<org.apache.maven.artifact.Artifact> artifacts) private org.apache.maven.project.MavenProjectbuildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact) protected DependencyStatusSetsfilterMarkedDependencies(Set<org.apache.maven.artifact.Artifact> artifacts) Filter the marked dependenciesprivate DependencyStatusSetsgetClassifierTranslatedDependencies(Set<org.apache.maven.artifact.Artifact> artifacts, boolean stopOnFailure) Transform artifactsprotected final org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverprotected 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.ArtifactsFilterReturn anArtifactsFilterindicating which artifacts must be filtered out.protected final org.apache.maven.shared.transfer.repository.RepositoryManagerprotected Set<org.apache.maven.artifact.Artifact> getResolvedDependencies(boolean stopOnFailure) Retrieves dependencies, either direct only or all including transitive.protected final ResolverUtilbooleanprivate Set<org.apache.maven.artifact.Artifact> voidsetMarkersDirectory(File theMarkersDirectory) voidsetPrependGroupId(boolean prependGroupId) Methods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
doExecute, execute, getProject, isSilent, isSkip, newResolveArtifactProjectBuildingRequest, newResolvePluginProjectBuildingRequest, setSilent, setSkipMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
resolverUtil
-
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
Comma Separated list of Types to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeTypes
Comma Separated list of Types to exclude. Empty String indicates don't exclude anything (default).- Since:
- 2.0
-
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:runtimeinclude scope gives runtime and compile dependencies,compileinclude scope gives compile, provided, and system dependencies,testinclude scope gives all dependencies (equivalent to default),providedinclude scope just gives provided dependencies,systeminclude scope just gives system dependencies.
- Since:
- 2.0
-
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:runtimeexclude scope excludes runtime and compile dependencies,compileexclude scope excludes compile, provided, and system dependencies,testexclude scope excludes all dependencies, then not really a legitimate option: it will fail, you probably meant to configure includeScope = compileprovidedexclude scope just excludes provided dependencies,systemexclude scope just excludes system dependencies.
- Since:
- 2.0
-
includeClassifiers
Comma Separated list of Classifiers to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeClassifiers
Comma Separated list of Classifiers to exclude. Empty String indicates don't exclude anything (default).- Since:
- 2.0
-
classifier
Specify classifier to look for. Example: sources- Since:
- 2.0
-
type
Specify type to look for when constructing artifact based on classifier. Example: java-source,jar,war- Since:
- 2.0
-
excludeArtifactIds
Comma separated list of Artifact names to exclude.- Since:
- 2.0
-
includeArtifactIds
Comma separated list of Artifact names to include. Empty String indicates include everything (default).- Since:
- 2.0
-
excludeGroupIds
Comma separated list of GroupId Names to exclude.- Since:
- 2.0
-
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 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
-
-
Constructor Details
-
AbstractDependencyFilterMojo
public AbstractDependencyFilterMojo()
-
-
Method Details
-
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 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-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, Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassifierTranslatedDependencies
private DependencyStatusSets getClassifierTranslatedDependencies(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(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
private Set<org.apache.maven.artifact.Artifact> resolve(Set<org.eclipse.aether.artifact.Artifact> artifacts, boolean stopOnFailure) throws org.apache.maven.plugin.MojoExecutionException - Parameters:
artifacts- The set of artifactsstopOnFailure-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
- Returns:
- Returns the markersDirectory.
-
setMarkersDirectory
- 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
- 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
-