Search in sources :

Example 1 with TestDependencyNode

use of org.sonatype.aether.test.util.impl.TestDependencyNode in project sonatype-aether by sonatype.

the class NodeBuilder method build.

public DependencyNode build() {
    Dependency dependency = null;
    TestDependencyNode node = new TestDependencyNode();
    if (artifactId != null && artifactId.length() > 0) {
        Artifact artifact = new StubArtifact(groupId, artifactId, classifier, ext, version, properties);
        dependency = new Dependency(artifact, scope, optional);
        node.setDependency(dependency);
        try {
            node.setVersion(versionScheme.parseVersion(version));
            node.setVersionConstraint(versionScheme.parseVersionConstraint(range != null ? range : version));
        } catch (InvalidVersionSpecificationException e) {
            throw new IllegalArgumentException("bad version: " + e.getMessage(), e);
        }
    }
    node.setRequestContext(context);
    node.setRelocations(relocations);
    return node;
}
Also used : TestDependencyNode(org.sonatype.aether.test.util.impl.TestDependencyNode) InvalidVersionSpecificationException(org.sonatype.aether.version.InvalidVersionSpecificationException) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Dependency(org.sonatype.aether.graph.Dependency) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Artifact(org.sonatype.aether.artifact.Artifact)

Aggregations

Artifact (org.sonatype.aether.artifact.Artifact)1 Dependency (org.sonatype.aether.graph.Dependency)1 StubArtifact (org.sonatype.aether.test.util.impl.StubArtifact)1 TestDependencyNode (org.sonatype.aether.test.util.impl.TestDependencyNode)1 InvalidVersionSpecificationException (org.sonatype.aether.version.InvalidVersionSpecificationException)1