Example usage for org.apache.maven.project DependencyResolutionResult getResolvedDependencies

List of usage examples for org.apache.maven.project DependencyResolutionResult getResolvedDependencies

Introduction

In this page you can find the example usage for org.apache.maven.project DependencyResolutionResult getResolvedDependencies.

Prototype

List<Dependency> getResolvedDependencies();

Source Link

Document

Gets the dependencies that were successfully resolved.

Usage

From source file:com.soebes.maven.extensions.BuildTimeProfiler.java

License:Apache License

private void dependencyResolutionResult(DependencyResolutionResult event) {
    LOGGER.debug("MBTP: dependencyResolutionResult() {}", event.getResolvedDependencies().size());
}

From source file:org.hudsonci.maven.eventspy_30.handler.DependencyResolutionResultHandler.java

License:Open Source License

public void handle(DependencyResolutionResult event) throws Exception {
    log.debug("DependencyResolution result: {}", event);

    getBuildRecorder().recordDependencyResolutionFinished(event.getResolvedDependencies());
}

From source file:org.jenkinsci.plugins.pipeline.maven.eventspy.handler.DependencyResolutionResultHandler.java

License:Open Source License

@Override
protected boolean _handle(DependencyResolutionResult result) {

    Xpp3Dom root = new Xpp3Dom("DependencyResolutionResult");
    root.setAttribute("class", result.getClass().getName());

    Xpp3Dom dependenciesElt = new Xpp3Dom("resolvedDependencies");
    root.addChild(dependenciesElt);//from   ww w . j  av a2  s .c o m

    for (Dependency dependency : result.getResolvedDependencies()) {
        Artifact artifact = dependency.getArtifact();

        if (!includedScopes.contains(dependency.getScope())) {
            continue;
        }
        if (!includeSnapshots && artifact.isSnapshot()) {
            continue;
        }
        if (!includeReleases && !artifact.isSnapshot()) {
            continue;
        }

        Xpp3Dom dependencyElt = new Xpp3Dom("dependency");

        dependencyElt.addChild(newElement("file", artifact.getFile().getAbsolutePath()));

        dependencyElt.setAttribute("name", artifact.getFile().getName());

        dependencyElt.setAttribute("groupId", artifact.getGroupId());
        dependencyElt.setAttribute("artifactId", artifact.getArtifactId());
        dependencyElt.setAttribute("version", artifact.getVersion());
        dependencyElt.setAttribute("baseVersion", artifact.getBaseVersion());
        if (artifact.getClassifier() != null) {
            dependencyElt.setAttribute("classifier", artifact.getClassifier());
        }
        dependencyElt.setAttribute("type", artifact.getExtension());
        dependencyElt.setAttribute("id", artifact.getArtifactId());
        dependencyElt.setAttribute("extension", artifact.getExtension());
        dependencyElt.setAttribute("scope", dependency.getScope());
        dependencyElt.setAttribute("optional", Boolean.toString(dependency.isOptional()));
        dependencyElt.setAttribute("snapshot", Boolean.toString(artifact.isSnapshot()));

        dependenciesElt.addChild(dependencyElt);
    }

    reporter.print(root);
    return true;
}

From source file:org.sourcepit.maven.dependency.model.aether.AetherDependencyModelResolver.java

License:Apache License

private void applyResolvedArtifacts(MavenProject project, DependencyResolutionResult resolutionResult,
        Collection<org.eclipse.aether.artifact.Artifact> resolvedAttachments, DependencyModel model) {
    Map<ArtifactKey, MavenArtifact> keyToArtifact = new HashMap<ArtifactKey, MavenArtifact>();

    EList<MavenArtifact> artifacts2 = model.getArtifacts();
    for (MavenArtifact mavenArtifact : artifacts2) {
        keyToArtifact.put(mavenArtifact.getArtifactKey(), mavenArtifact);
    }//from w w w  .  ja va  2 s .c  om

    for (org.eclipse.aether.artifact.Artifact artifact : resolvedAttachments) {
        final ArtifactKey artifactKey = toArtifactKey(artifact);
        keyToArtifact.get(artifactKey).setFile(artifact.getFile());
    }

    for (org.eclipse.aether.graph.Dependency dependency : resolutionResult.getResolvedDependencies()) {
        org.eclipse.aether.artifact.Artifact artifact = dependency.getArtifact();
        final ArtifactKey artifactKey = toArtifactKey(artifact);
        keyToArtifact.get(artifactKey).setFile(artifact.getFile());
    }
}