-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDEP-923] Move methods in place where are used
- Loading branch information
1 parent
ad5fdc5
commit fd17de4
Showing
4 changed files
with
66 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,28 +19,15 @@ | |
package org.apache.maven.plugins.dependency.resolvers; | ||
|
||
import java.io.File; | ||
import java.util.LinkedHashSet; | ||
import java.util.Set; | ||
|
||
import org.apache.maven.artifact.Artifact; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo; | ||
import org.apache.maven.plugins.dependency.utils.DependencyUtil; | ||
import org.apache.maven.project.ProjectBuildingRequest; | ||
import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter; | ||
import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter; | ||
import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts; | ||
import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter; | ||
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter; | ||
import org.apache.maven.shared.artifact.filter.collection.TypeFilter; | ||
import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult; | ||
import org.apache.maven.shared.transfer.dependencies.DependableCoordinate; | ||
import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Brian Fox</a> | ||
*/ | ||
public abstract class AbstractResolveMojo extends AbstractDependencyFilterMojo { | ||
|
||
/** | ||
* If specified, this parameter causes the dependencies to be written to the path specified instead of | ||
* the console. | ||
|
@@ -65,67 +52,4 @@ public abstract class AbstractResolveMojo extends AbstractDependencyFilterMojo { | |
*/ | ||
@Parameter(property = "excludeReactor", defaultValue = "true") | ||
protected boolean excludeReactor; | ||
|
||
/** | ||
* <i>not used in this goal</i> | ||
*/ | ||
@Parameter | ||
protected boolean ignorePermissions; | ||
|
||
/** | ||
* @return {@link FilterArtifacts} | ||
*/ | ||
protected FilterArtifacts getArtifactsFilter() { | ||
final FilterArtifacts filter = new FilterArtifacts(); | ||
|
||
if (excludeReactor) { | ||
|
||
filter.addFilter(new ExcludeReactorProjectsArtifactFilter(reactorProjects, getLog())); | ||
} | ||
|
||
filter.addFilter(new ScopeFilter( | ||
DependencyUtil.cleanToBeTokenizedString(this.includeScope), | ||
DependencyUtil.cleanToBeTokenizedString(this.excludeScope))); | ||
|
||
filter.addFilter(new TypeFilter( | ||
DependencyUtil.cleanToBeTokenizedString(this.includeTypes), | ||
DependencyUtil.cleanToBeTokenizedString(this.excludeTypes))); | ||
|
||
filter.addFilter(new ClassifierFilter( | ||
DependencyUtil.cleanToBeTokenizedString(this.includeClassifiers), | ||
DependencyUtil.cleanToBeTokenizedString(this.excludeClassifiers))); | ||
|
||
filter.addFilter(new GroupIdFilter( | ||
DependencyUtil.cleanToBeTokenizedString(this.includeGroupIds), | ||
DependencyUtil.cleanToBeTokenizedString(this.excludeGroupIds))); | ||
|
||
filter.addFilter(new ArtifactIdFilter( | ||
DependencyUtil.cleanToBeTokenizedString(this.includeArtifactIds), | ||
DependencyUtil.cleanToBeTokenizedString(this.excludeArtifactIds))); | ||
|
||
return filter; | ||
} | ||
|
||
/** | ||
* This method resolves all transitive dependencies of an artifact. | ||
* | ||
* @param artifact the artifact used to retrieve dependencies | ||
* @return resolved set of dependencies | ||
* @throws DependencyResolverException in case of error while resolving artifacts. | ||
*/ | ||
protected Set<Artifact> resolveArtifactDependencies(final DependableCoordinate artifact) | ||
throws DependencyResolverException { | ||
ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest(); | ||
|
||
Iterable<ArtifactResult> artifactResults = | ||
getDependencyResolver().resolveDependencies(buildingRequest, artifact, null); | ||
|
||
Set<Artifact> artifacts = new LinkedHashSet<>(); | ||
|
||
for (final ArtifactResult artifactResult : artifactResults) { | ||
artifacts.add(artifactResult.getArtifact()); | ||
} | ||
|
||
return artifacts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters