/** * Creates a request for the specified dependency graph and with the given resolution filter. * * @param node The root node of the dependency graph whose artifacts should be resolved, may be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( DependencyNode node, DependencyFilter filter ) { setRoot( node ); setFilter( filter ); }
/** * Creates a request for the specified dependency graph and with the given resolution filter. * * @param node The root node of the dependency graph whose artifacts should be resolved, may be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( DependencyNode node, DependencyFilter filter ) { setRoot( node ); setFilter( filter ); }
/** * Creates a request for the specified collect request and with the given resolution filter. * * @param request The collect request used to calculate the dependency graph whose artifacts should be resolved, may * be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( CollectRequest request, DependencyFilter filter ) { setCollectRequest( request ); setFilter( filter ); }
/** * Creates a request for the specified dependency graph and with the given resolution filter. * * @param node The root node of the dependency graph whose artifacts should be resolved, may be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( DependencyNode node, DependencyFilter filter ) { setRoot( node ); setFilter( filter ); }
/** * Creates a request for the specified collect request and with the given resolution filter. * * @param request The collect request used to calculate the dependency graph whose artifacts should be resolved, may * be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( CollectRequest request, DependencyFilter filter ) { setCollectRequest( request ); setFilter( filter ); }
/** * Creates a request for the specified collect request and with the given resolution filter. * * @param request The collect request used to calculate the dependency graph whose artifacts should be resolved, may * be {@code null}. * @param filter The resolution filter to use, may be {@code null}. */ public DependencyRequest( CollectRequest request, DependencyFilter filter ) { setCollectRequest( request ); setFilter( filter ); }
private DependencyRequest createRequest(final Dependency dependency) { final CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(dependency); collectRequest.addRepository(remoteRepository); final DependencyRequest dependencyRequest = new DependencyRequest(); dependencyRequest.setCollectRequest(collectRequest); for (final DependencyFilter filter : dependencyFilters) { dependencyRequest.setFilter(filter); } return dependencyRequest; }
private List<Artifact> getArtifacts(String artifact) throws MojoExecutionException { Dependency dependency = new Dependency( new DefaultArtifact( artifact ), "runtime" ); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot( dependency ); //collectRequest.addRepository( remoteRepos ); DependencyNode node; try { node = repoSystem.collectDependencies( repoSession, collectRequest ).getRoot(); } catch (DependencyCollectionException e) { throw new MojoExecutionException( e.getMessage(), e ); } DependencyRequest dependencyRequest = new DependencyRequest( node, null ); Set<String> included = Collections.singleton("runtime"); dependencyRequest.setFilter(new ScopeDependencyFilter(included, Collections.EMPTY_SET)); try { repoSystem.resolveDependencies( repoSession, dependencyRequest ); } catch (DependencyResolutionException e) { throw new MojoExecutionException( e.getMessage(), e ); } PreorderNodeListGenerator nlg = new PreorderNodeListGenerator(); node.accept( nlg ); getLog().info( "" + nlg.getClassPath() ); return nlg.getArtifacts(false); }