use of org.apache.maven.plugins.dependency.utils.translators.ArtifactTranslator in project maven-plugins by apache.
the class AbstractDependencyFilterMojo method getClassifierTranslatedDependencies.
/**
* Transform artifacts
*
* @param artifacts
* @param stopOnFailure
* @return DependencyStatusSets - Bean of TreeSets that contains information
* on the projects dependencies
* @throws MojoExecutionException
*/
protected DependencyStatusSets getClassifierTranslatedDependencies(Set<Artifact> artifacts, boolean stopOnFailure) throws MojoExecutionException {
Set<Artifact> unResolvedArtifacts = new LinkedHashSet<Artifact>();
Set<Artifact> resolvedArtifacts = artifacts;
DependencyStatusSets status = new DependencyStatusSets();
// if this did something, we need to resolve the new artifacts
if (StringUtils.isNotEmpty(classifier)) {
ArtifactTranslator translator = new ClassifierTypeTranslator(artifactHandlerManager, this.classifier, this.type);
Collection<ArtifactCoordinate> coordinates = translator.translate(artifacts, getLog());
status = filterMarkedDependencies(artifacts);
// the unskipped artifacts are in the resolved set.
artifacts = status.getResolvedDependencies();
// resolve the rest of the artifacts
resolvedArtifacts = resolve(new LinkedHashSet<ArtifactCoordinate>(coordinates), stopOnFailure);
// calculate the artifacts not resolved.
unResolvedArtifacts.addAll(artifacts);
unResolvedArtifacts.removeAll(resolvedArtifacts);
}
// return a bean of all 3 sets.
status.setResolvedDependencies(resolvedArtifacts);
status.setUnResolvedDependencies(unResolvedArtifacts);
return status;
}
Aggregations