use of org.eclipse.aether.util.filter.AndDependencyFilter in project grails-maven by grails.
the class AbstractGrailsMojo method resolveArtifacts.
protected List<File> resolveArtifacts(MavenProject mavenProject, Collection<String> scopes, DependencyFilter filter) throws MojoExecutionException {
try {
DefaultDependencyResolutionRequest request = new DefaultDependencyResolutionRequest(mavenProject, repoSession);
if (filter != null) {
request.setResolutionFilter(new AndDependencyFilter(new ScopeDependencyFilter(scopes, Collections.<String>emptyList()), filter));
} else {
request.setResolutionFilter(new ScopeDependencyFilter(scopes, Collections.<String>emptyList()));
}
DependencyResolutionResult result = projectDependenciesResolver.resolve(request);
List<org.eclipse.aether.graph.Dependency> dependencies = result.getDependencies();
final List<File> files = new ArrayList<File>();
for (org.eclipse.aether.graph.Dependency d : dependencies) {
org.eclipse.aether.artifact.Artifact artifact = d.getArtifact();
File file = artifact.getFile();
if (file != null) {
String name = file.getName();
if (!name.contains("xml-apis") && !name.contains("commons-logging"))
files.add(file);
}
}
return files;
} catch (DependencyResolutionException e) {
throw new MojoExecutionException("Dependency resolution failure: " + e.getMessage(), e);
}
}
Aggregations