private List<ArtifactResult> fetchArtifactWithDep(Dependency dep) throws DependencyResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(dep.getGroupArtifactVersion()); DependencyFilter classpathFilter = DependencyFilterUtils .classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter( dep.getExclusions()); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new org.sonatype.aether.graph.Dependency(artifact, JavaScopes.COMPILE)); collectRequest.addRepository(mavenCentral); collectRequest.addRepository(mavenLocal); for (Repository repo : repositories) { RemoteRepository rr = new RemoteRepository(repo.getId(), "default", repo.getUrl()); rr.setPolicy(repo.isSnapshot(), null); collectRequest.addRepository(rr); } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); }
@Override public List<Exception> getCollectorExceptions() { return dce.getResult().getExceptions(); } };
/** * Creates a request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<RemoteRepository> repositories ) { setRoot( root ); setRepositories( repositories ); }
/** * Creates a new request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param dependencies The direct dependencies to merge with the direct dependencies from the root dependency's * artifact descriptor. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<Dependency> dependencies, List<RemoteRepository> repositories ) { setRoot( root ); setDependencies( dependencies ); setRepositories( repositories ); }
@Override public String toString() { return getRoot() + " -> " + getDependencies() + " < " + getRepositories(); }
/** * Creates a new request with the specified properties. * * @param dependencies The direct dependencies of some imaginary root, may be {@code null}. * @param managedDependencies The dependency management information to apply to the transitive dependencies, may be * {@code null}. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( List<Dependency> dependencies, List<Dependency> managedDependencies, List<RemoteRepository> repositories ) { setDependencies( dependencies ); setManagedDependencies( managedDependencies ); setRepositories( repositories ); }
private static String getSource( CollectResult result ) { if ( result == null ) { return ""; } CollectRequest request = result.getRequest(); if ( request.getRoot() != null ) { return request.getRoot().toString(); } return request.getDependencies().toString(); }
public DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context ) throws RepositoryException { for ( DependencyGraphTransformer transformer : transformers ) { node = transformer.transformGraph( node, context ); } return node; }
public boolean selectDependency( Dependency dependency ) { for ( DependencySelector selector : selectors ) { if ( !selector.selectDependency( dependency ) ) { return false; } } return true; }
new PatternExclusionsDependencyFilter(excludes); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE)); collectRequest.addRepository(repo);
/** * Creates a new request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param dependencies The direct dependencies to merge with the direct dependencies from the root dependency's * artifact descriptor. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<Dependency> dependencies, List<RemoteRepository> repositories ) { setRoot( root ); setDependencies( dependencies ); setRepositories( repositories ); }
/** * Creates a request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<RemoteRepository> repositories ) { setRoot( root ); setRepositories( repositories ); }
@Override public String toString() { return getRoot() + " -> " + getDependencies() + " < " + getRepositories(); }
/** * Creates a new request with the specified properties. * * @param dependencies The direct dependencies of some imaginary root, may be {@code null}. * @param managedDependencies The dependency management information to apply to the transitive dependencies, may be * {@code null}. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( List<Dependency> dependencies, List<Dependency> managedDependencies, List<RemoteRepository> repositories ) { setDependencies( dependencies ); setManagedDependencies( managedDependencies ); setRepositories( repositories ); }
/** * Creates a new request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param dependencies The direct dependencies to merge with the direct dependencies from the root dependency's * artifact descriptor. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<Dependency> dependencies, List<RemoteRepository> repositories ) { setRoot( root ); setDependencies( dependencies ); setRepositories( repositories ); }
/** * Creates a request with the specified properties. * * @param root The root dependency whose transitive dependencies should be collected, may be {@code null}. * @param repositories The repositories to use for the collection, may be {@code null}. */ public CollectRequest( Dependency root, List<RemoteRepository> repositories ) { setRoot( root ); setRepositories( repositories ); }
@Override public String toString() { return getRoot() + " -> " + getDependencies() + " < " + getRepositories(); }