Dependency root = new Dependency( artifact, "" );
collectRequest.setRoot( root );
for (RemoteRepository repo : remoteRepositoriesForRequest) {
collectRequest.addRepository(repo);
}
CollectResult collectResult;
try {
collectResult = aether.getSystem().collectDependencies(aether.getSession(), collectRequest);
} catch (DependencyCollectionException e) {
throw new RuntimeException(e);
}
CollectDependencyVisitor visitor = new CollectDependencyVisitor();
collectResult.getRoot().accept( visitor );
List<DependencyDescriptor> descriptors = new ArrayList<DependencyDescriptor>();
for (DependencyNode node : visitor.getDependencies()) {
// skip root to not add artifact as dependency
if (node.getDependency().equals(root)) {