Search in sources :

Example 11 with DependencyResolutionException

use of org.eclipse.aether.resolution.DependencyResolutionException in project fabric8 by jboss-fuse.

the class AetherBasedResolver method resolveDependencies.

protected DependencyNode resolveDependencies(RepositorySystemSession session, List<RemoteRepository> repos, DependencyNode pomNode, Dependency dependency, final Filter<Dependency> shouldExclude) throws FailedToResolveDependency {
    if (!DependencyFilters.matches(dependency, shouldExclude)) {
        CollectRequest cr = new CollectRequest(dependency, repos);
        // request.setRequestContext("runtime");
        try {
            DependencyNode node = m_repoSystem.collectDependencies(session, cr).getRoot();
            DependencyFilter filter = new DependencyFilter() {

                public boolean accept(DependencyNode node, List<DependencyNode> parents) {
                    return !DependencyFilters.matches(node, shouldExclude);
                }
            };
            DependencyRequest request = new DependencyRequest(cr, filter);
            m_repoSystem.resolveDependencies(session, request);
            return node;
        } catch (DependencyResolutionException | DependencyCollectionException e) {
            handleDependencyResolveFailure(pomNode, dependency, e);
        }
    }
    return null;
}
Also used : DependencyCollectionException(org.eclipse.aether.collection.DependencyCollectionException) DependencyRequest(org.eclipse.aether.resolution.DependencyRequest) DefaultDependencyNode(org.eclipse.aether.graph.DefaultDependencyNode) DependencyNode(org.eclipse.aether.graph.DependencyNode) DependencyFilter(org.eclipse.aether.graph.DependencyFilter) ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList) DependencyResolutionException(org.eclipse.aether.resolution.DependencyResolutionException) CollectRequest(org.eclipse.aether.collection.CollectRequest)

Example 12 with DependencyResolutionException

use of org.eclipse.aether.resolution.DependencyResolutionException in project spf4j by zolyfarkas.

the class ApiChangesMojo method execute.

@Override
public void execute() throws MojoExecutionException {
    MavenProject mavenProject = getMavenProject();
    try {
        getLog().info("Executing JDiff javadoc doclet");
        JDiffRunner runner = new JDiffRunner(getMojoExecution(), getToolchainManager(), getMavenSession(), getProjectRepos(), getRepoSystem(), getJavadocExecutable());
        runner.runDiffBetweenReleases(mavenProject.getGroupId(), mavenProject.getArtifactId(), this.versionRange, destDir, maxNumberOfDiffs);
        runner.writeChangesIndexHtml(destDir, "changes.html");
        getLog().info("Generated " + destDir + File.separatorChar + "changes.html");
    } catch (IOException | DependencyResolutionException | VersionRangeResolutionException | ArtifactResolutionException | JavadocExecutionException ex) {
        throw new MojoExecutionException("Failed executing mojo " + this, ex);
    }
}
Also used : ArtifactResolutionException(org.eclipse.aether.resolution.ArtifactResolutionException) MavenProject(org.apache.maven.project.MavenProject) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) DependencyResolutionException(org.eclipse.aether.resolution.DependencyResolutionException) IOException(java.io.IOException) VersionRangeResolutionException(org.eclipse.aether.resolution.VersionRangeResolutionException)

Example 13 with DependencyResolutionException

use of org.eclipse.aether.resolution.DependencyResolutionException in project mule by mulesoft.

the class DependencyResolver method logUnresolvedArtifacts.

/**
 * Logs the paths for each dependency not found
 *
 * @param node root {@link DependencyNode}, can be a "null" root (imaginary root)
 * @param e {@link DependencyResolutionException} the error to collect paths.
 */
private void logUnresolvedArtifacts(DependencyNode node, DependencyResolutionException e) {
    List<ArtifactResult> artifactResults = e.getResult().getArtifactResults().stream().filter(artifactResult -> !artifactResult.getExceptions().isEmpty()).collect(toList());
    final List<String> patternInclusion = artifactResults.stream().map(artifactResult -> toId(artifactResult.getRequest().getArtifact())).collect(toList());
    PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor(new PatternInclusionsDependencyFilter(patternInclusion), node.getArtifact() != null);
    node.accept(visitor);
    visitor.getPaths().stream().forEach(path -> {
        List<DependencyNode> unresolvedArtifactPath = path.stream().filter(dependencyNode -> dependencyNode.getArtifact() != null).collect(toList());
        if (!unresolvedArtifactPath.isEmpty()) {
            logger.warn("Dependency path to not resolved artifacts -> {}", unresolvedArtifactPath.toString());
        }
    });
}
Also used : DependencyFilter(org.eclipse.aether.graph.DependencyFilter) ArtifactDescriptorRequest(org.eclipse.aether.resolution.ArtifactDescriptorRequest) MavenConfiguration(org.mule.maven.client.api.model.MavenConfiguration) Dependency(org.eclipse.aether.graph.Dependency) LoggerFactory(org.slf4j.LoggerFactory) RepositorySystemSession(org.eclipse.aether.RepositorySystemSession) PatternInclusionsDependencyFilter(org.eclipse.aether.util.filter.PatternInclusionsDependencyFilter) ArtifactDescriptorException(org.eclipse.aether.resolution.ArtifactDescriptorException) AetherResolutionContext(org.mule.maven.client.internal.AetherResolutionContext) ArtifactResolutionException(org.eclipse.aether.resolution.ArtifactResolutionException) DependencyResolutionException(org.eclipse.aether.resolution.DependencyResolutionException) ArtifactIdUtils.toId(org.eclipse.aether.util.artifact.ArtifactIdUtils.toId) CollectRequest(org.eclipse.aether.collection.CollectRequest) DependencyCollectionException(org.eclipse.aether.collection.DependencyCollectionException) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ReflectionToStringBuilder(org.apache.commons.lang3.builder.ReflectionToStringBuilder) DependencyNode(org.eclipse.aether.graph.DependencyNode) Artifact(org.eclipse.aether.artifact.Artifact) PreorderNodeListGenerator(org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator) Preconditions.checkNotNull(org.mule.runtime.api.util.Preconditions.checkNotNull) AetherRepositoryState(org.mule.maven.client.internal.AetherRepositoryState) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult) DependencyRequest(org.eclipse.aether.resolution.DependencyRequest) Joiner.on(com.google.common.base.Joiner.on) File(java.io.File) WorkspaceReader(org.eclipse.aether.repository.WorkspaceReader) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ArtifactRequest(org.eclipse.aether.resolution.ArtifactRequest) Optional(java.util.Optional) PathRecordingDependencyVisitor(org.eclipse.aether.util.graph.visitor.PathRecordingDependencyVisitor) ArtifactDescriptorResult(org.eclipse.aether.resolution.ArtifactDescriptorResult) RepositorySystem(org.eclipse.aether.RepositorySystem) PatternInclusionsDependencyFilter(org.eclipse.aether.util.filter.PatternInclusionsDependencyFilter) PathRecordingDependencyVisitor(org.eclipse.aether.util.graph.visitor.PathRecordingDependencyVisitor) DependencyNode(org.eclipse.aether.graph.DependencyNode) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult)

Example 14 with DependencyResolutionException

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

the class PinpointPluginTestSuite method createSharedCasesWithDependencies.

private List<PinpointPluginTestInstance> createSharedCasesWithDependencies(PluginTestContext context) throws ArtifactResolutionException, DependencyResolutionException {
    DependencyResolver resolver = getDependencyResolver(this.repositories);
    Map<String, List<Artifact>> dependencyMap = resolver.resolveDependencySets(dependencies);
    if (logger.isDebugEnabled()) {
        for (Map.Entry<String, List<Artifact>> entry : dependencyMap.entrySet()) {
            logger.debug("{} {}", entry.getKey(), entry.getValue());
        }
    }
    List<PinpointPluginTestInstance> cases = new ArrayList<>();
    SharedProcessManager sharedProcessManager = new SharedProcessManager(context);
    for (Map.Entry<String, List<Artifact>> artifactEntry : dependencyMap.entrySet()) {
        final String testId = artifactEntry.getKey();
        final List<Artifact> artifacts = artifactEntry.getValue();
        List<String> libs = null;
        try {
            libs = resolveArtifactsAndDependencies(resolver, artifacts);
        } catch (DependencyResolutionException e) {
            // TODO Skip when running the test
            logger.warn(e, "resolveArtifactsAndDependencies failed testId={}", testId);
            continue;
        }
        PinpointPluginTestInstance testInstance = newSharedProcessPluginTestCase(context, testId, libs, sharedProcessManager);
        cases.add(testInstance);
        sharedProcessManager.registerTest(testInstance.getTestId(), artifacts);
    }
    return cases;
}
Also used : ArrayList(java.util.ArrayList) Artifact(org.eclipse.aether.artifact.Artifact) ArrayList(java.util.ArrayList) List(java.util.List) DependencyResolutionException(org.eclipse.aether.resolution.DependencyResolutionException) HashMap(java.util.HashMap) Map(java.util.Map) SharedProcessManager(com.navercorp.pinpoint.test.plugin.shared.SharedProcessManager)

Aggregations

DependencyResolutionException (org.eclipse.aether.resolution.DependencyResolutionException)14 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)11 CollectRequest (org.eclipse.aether.collection.CollectRequest)10 Artifact (org.eclipse.aether.artifact.Artifact)9 Dependency (org.eclipse.aether.graph.Dependency)7 DependencyNode (org.eclipse.aether.graph.DependencyNode)7 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)6 DependencyCollectionException (org.eclipse.aether.collection.DependencyCollectionException)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)4 PreorderNodeListGenerator (org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator)4 IOException (java.io.IOException)3 MalformedURLException (java.net.MalformedURLException)3 URL (java.net.URL)3 List (java.util.List)3 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)3 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)3 DependencyResult (org.eclipse.aether.resolution.DependencyResult)3 HashMap (java.util.HashMap)2