@Override
  public DependencyResult resolveDependencies(
      RepositorySystemSession session, DependencyRequest request)
      throws DependencyResolutionException {

    debugf("resolveDependencies %s", request.getCollectRequest());
    // TODO: assert that the request does not traverse repos
    return delegate.resolveDependencies(session, request);
    //        throw new RuntimeException(
    //                "NYI: org.fedoraproject.maven.repository.internal." +
    //                "FossRepositorySystem.resolveDependencies");
  }
示例#2
0
  public AetherResult resolve(
      String groupId, String artifactId, String version, String extension, String classifier)
      throws PlexusContainerException, ComponentLookupException, DependencyCollectionException,
          ArtifactResolutionException, DependencyResolutionException {
    if (Strings.isBlank(extension) || extension.equals("bundle")) {
      extension = DEFAULT_EXTENSION;
    }
    if (classifier == null) {
      classifier = DEFAULT_CLASSIFIER;
    }

    RepositorySystemSession session = newSession();
    Dependency dependency =
        new Dependency(
            new DefaultArtifact(groupId, artifactId, classifier, extension, version), "runtime");

    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setRoot(dependency);

    List<RemoteRepository> repos = getRemoteRepositories();
    RemoteRepository[] repoArray = new RemoteRepository[repos.size()];
    repos.toArray(repoArray);
    for (RemoteRepository repo : repoArray) {
      collectRequest.addRepository(repo);
    }
    RepositorySystem system = getRepositorySystem();
    DependencyNode rootNode = system.collectDependencies(session, collectRequest).getRoot();
    DependencyRequest dependencyRequest = new DependencyRequest();
    dependencyRequest.setRoot(rootNode);
    system.resolveDependencies(session, dependencyRequest);

    PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
    rootNode.accept(nlg);

    return new AetherResult(rootNode, nlg.getFiles(), nlg.getClassPath());
  }