Search in sources :

Example 56 with Dependency

use of org.eclipse.aether.graph.Dependency in project jqa-core-framework by buschmais.

the class AetherPluginResolverImpl method createClassLoader.

@Override
public PluginClassLoader createClassLoader(ClassLoader parent, List<Plugin> plugins) {
    List<Dependency> requiredPlugins = getRequiredPluginDependencies(plugins);
    DependencyResult dependencyResult = resolvePlugins(requiredPlugins);
    return new PluginClassLoader(getDependencyURLs(dependencyResult), parent);
}
Also used : DependencyResult(org.eclipse.aether.resolution.DependencyResult) Dependency(org.eclipse.aether.graph.Dependency) PluginClassLoader(com.buschmais.jqassistant.core.plugin.api.PluginClassLoader)

Example 57 with Dependency

use of org.eclipse.aether.graph.Dependency in project spf4j by zolyfarkas.

the class MavenRepositoryUtils method resolveArtifactAndDependencies.

public static Set<File> resolveArtifactAndDependencies(final String scope, final String groupId, final String artifactId, final String classifier, final String extension, final String versionExpr, final List<RemoteRepository> repos, final RepositorySystem repositorySystem, final RepositorySystemSession session) throws DependencyResolutionException {
    Artifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, versionExpr);
    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setRoot(new Dependency(artifact, scope));
    collectRequest.setRepositories(repos);
    DependencyFilter dependencyFilter = DependencyFilterUtils.classpathFilter(scope);
    if (classifier != null) {
        dependencyFilter = DependencyFilterUtils.andFilter(new ClassifierDependencyFilter(classifier));
    }
    DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, dependencyFilter);
    DependencyResult depresult = repositorySystem.resolveDependencies(session, dependencyRequest);
    List<ArtifactResult> artifactResults = depresult.getArtifactResults();
    Set<File> result = Sets.newHashSetWithExpectedSize(artifactResults.size());
    for (ArtifactResult ar : artifactResults) {
        result.add(ar.getArtifact().getFile());
    }
    return result;
}
Also used : DependencyRequest(org.eclipse.aether.resolution.DependencyRequest) DependencyResult(org.eclipse.aether.resolution.DependencyResult) DependencyFilter(org.eclipse.aether.graph.DependencyFilter) Dependency(org.eclipse.aether.graph.Dependency) CollectRequest(org.eclipse.aether.collection.CollectRequest) File(java.io.File) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) Artifact(org.eclipse.aether.artifact.Artifact) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult)

Aggregations

Dependency (org.eclipse.aether.graph.Dependency)57 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)39 Artifact (org.eclipse.aether.artifact.Artifact)36 File (java.io.File)25 CollectRequest (org.eclipse.aether.collection.CollectRequest)22 ArrayList (java.util.ArrayList)19 DependencyNode (org.eclipse.aether.graph.DependencyNode)17 ArtifactResult (org.eclipse.aether.resolution.ArtifactResult)17 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)17 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)15 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)15 ArtifactDescriptorResult (org.eclipse.aether.resolution.ArtifactDescriptorResult)14 IOException (java.io.IOException)13 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)13 Exclusion (org.eclipse.aether.graph.Exclusion)13 MalformedURLException (java.net.MalformedURLException)12 DependencyResolutionException (org.eclipse.aether.resolution.DependencyResolutionException)11 List (java.util.List)10 URL (java.net.URL)9 ArtifactDescriptorException (org.eclipse.aether.resolution.ArtifactDescriptorException)9