code: public static Optional<File> resolvePluginDependency(Dependency d, List<RemoteRepository> pluginRepos,
        ArtifactResolver resolver, RepositorySystemSession repoSystemSession) {
      Artifact a = new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion());
      ArtifactRequest artifactRequest = new ArtifactRequest();
      artifactRequest.setArtifact(a);
      artifactRequest.setRepositories(pluginRepos);
      try {
        ArtifactResult artifactResult = resolver.resolveArtifact(repoSystemSession, artifactRequest);
        if (artifactResult.getArtifact() != null) {
          return Optional.fromNullable(artifactResult.getArtifact().getFile());
        }
        return Optional.absent();
      } catch (ArtifactResolutionException e) {
        return Optional.absent();
      }
    }
docs: Uses the aether to resolve a plugin dependency and returns the file for further processing.
  
  @param d the dependency to resolve.
  @param pluginRepos the plugin repositories to use for dependency resolution.
  @param resolver the resolver for aether access.
  @param repoSystemSession the session for the resolver.
  @return optionally a file which is the resolved dependency.