Search in sources :

Example 11 with DependencyResult

use of org.eclipse.aether.resolution.DependencyResult in project pinpoint by naver.

the class DependencyResolver method resolveArtifactsAndDependencies.

public List<File> resolveArtifactsAndDependencies(List<Artifact> artifacts) throws DependencyResolutionException {
    List<Dependency> dependencies = new ArrayList<>();
    for (Artifact artifact : artifacts) {
        dependencies.add(new Dependency(artifact, JavaScopes.RUNTIME));
    }
    CollectRequest collectRequest = new CollectRequest((Dependency) null, dependencies, repositories);
    DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.RUNTIME);
    DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);
    DependencyResult result = system.resolveDependencies(session, dependencyRequest);
    List<File> files = new ArrayList<>();
    for (ArtifactResult artifactResult : result.getArtifactResults()) {
        files.add(artifactResult.getArtifact().getFile());
    }
    return files;
}
Also used : DependencyRequest(org.eclipse.aether.resolution.DependencyRequest) DependencyResult(org.eclipse.aether.resolution.DependencyResult) ArrayList(java.util.ArrayList) 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) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult)

Example 12 with DependencyResult

use of org.eclipse.aether.resolution.DependencyResult 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)

Aggregations

DependencyResult (org.eclipse.aether.resolution.DependencyResult)12 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)10 CollectRequest (org.eclipse.aether.collection.CollectRequest)8 Dependency (org.eclipse.aether.graph.Dependency)7 Artifact (org.eclipse.aether.artifact.Artifact)6 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)6 ArtifactResult (org.eclipse.aether.resolution.ArtifactResult)6 File (java.io.File)4 ArrayList (java.util.ArrayList)4 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)4 DependencyNode (org.eclipse.aether.graph.DependencyNode)3 DependencyResolutionException (org.eclipse.aether.resolution.DependencyResolutionException)3 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 RepositorySystem (org.eclipse.aether.RepositorySystem)2 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)2 SubArtifact (org.eclipse.aether.util.artifact.SubArtifact)2 PluginClassLoader (com.buschmais.jqassistant.core.plugin.api.PluginClassLoader)1 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 Utils.getRepositorySystem (gate.util.maven.Utils.getRepositorySystem)1