@NotNull
  public Collection<Artifact> resolveDependencyAsArtifact(String groupId, String artifactId, String versionConstraint,
                                                          Set<ArtifactKind> artifactKinds, boolean includeTransitiveDependencies,
                                                          List<String> excludedDependencies) throws Exception {
    List<Artifact> artifacts = new ArrayList<>();
    VersionConstraint originalConstraints = asVersionConstraint(versionConstraint);
    for (ArtifactKind kind : artifactKinds) {
      // RepositorySystem.resolveDependencies() ignores classifiers, so we need to set classifiers explicitly for discovered dependencies.
      // Because of that, we have to first discover deps and then resolve corresponding artifacts
      try {
        List<ArtifactRequest> requests = new ArrayList<>();
        Set<VersionConstraint> constraints;
        if (kind == ArtifactKind.ANNOTATIONS) {
          constraints = relaxForAnnotations(originalConstraints);
        } else {
          constraints = Collections.singleton(originalConstraints);
        }
        RepositorySystemSession session = prepareRequests(groupId, artifactId, constraints, kind, includeTransitiveDependencies, excludedDependencies, requests);

        if (LOG.isDebugEnabled()) {
          LOG.debug("Resolving " + groupId + ":" + artifactId + ":" + versionConstraint +
                    " transitiveDependencies=" + includeTransitiveDependencies +
                    " excludedDependencies=" + excludedDependencies +
                    " kind=" + kind +
                    " requests=" + requests);
        }

        if (!requests.isEmpty()) {
          try {
            List<ArtifactResult> resultList = mySessionFactory.retryWithClearSessionData(
              session,
              s -> ourSystem.resolveArtifacts(s, requests)
            ).getResult();

            for (ArtifactResult result : resultList) {
              artifacts.add(result.getArtifact());
            }
          }
          catch (ArtifactResolutionException e) {
            if (kind != ArtifactKind.ARTIFACT) {
              // for sources and javadocs, try to process requests one-by-one and fetch at least something
              if (requests.size() > 1) {
                for (ArtifactRequest request : requests) {
                  try {
                    // Don't retry on sources or javadocs resolution: used only in IDE, will only waste user's time if the artifact does not
                    // exist.
                    ArtifactResult result = ourSystem.resolveArtifact(session, request);
                    artifacts.add(result.getArtifact());
                  }
                  catch (ArtifactResolutionException ignored) {
                  }
                }
              }
            }
            else {
              // for ArtifactKind.ARTIFACT should fail if at least one request in this group fails
              throw e;
            }
          }
        }
      }
      catch (DependencyCollectionException e) {
        if (kind == ArtifactKind.ARTIFACT) {
          throw e;
        }
      }
    }
    return artifacts;
  }
@NotNull
  public Collection<Artifact> resolveDependencyAsArtifact(String groupId, String artifactId, String versionConstraint,
                                                          Set<ArtifactKind> artifactKinds, boolean includeTransitiveDependencies,
                                                          List<String> excludedDependencies)