Examples of MavenDependencyImpl


Examples of org.jboss.shrinkwrap.resolver.impl.maven.coordinate.MavenDependencyImpl

        final MavenCoordinate coordinate = this.createCoordinate();
        final ScopeType scope = ScopeType.RUNTIME;
        final boolean optional = true;
        final MavenDependencyExclusion exclusion1 = new MavenDependencyExclusionImpl("groupId1", "artifactId1");
        final MavenDependencyExclusion exclusion2 = new MavenDependencyExclusionImpl("groupId2", "artifactId2");
        final MavenDependency dependency1 = new MavenDependencyImpl(coordinate, scope, optional, exclusion1, exclusion2);
        final MavenDependency dependency2 = new MavenDependencyImpl(coordinate, scope, optional, exclusion1, exclusion2);
        Assert.assertTrue(dependency1.hashCode() == dependency2.hashCode());
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.impl.maven.coordinate.MavenDependencyImpl

        final ScopeType scope = ScopeType.IMPORT;
        final boolean optional = true;
        final MavenCoordinate coordinate = new MavenCoordinateImpl(groupId, artifactId, version, packaging, classifier);
        final MavenDependencyExclusion exclusion1 = new MavenDependencyExclusionImpl("groupId1", "artifactId1");
        final MavenDependencyExclusion exclusion2 = new MavenDependencyExclusionImpl("groupId2", "artifactId2");
        final MavenDependency dependency = new MavenDependencyImpl(coordinate, scope, optional, exclusion1, exclusion2);
        Assert.assertEquals(groupId, dependency.getGroupId());
        Assert.assertEquals(artifactId, dependency.getArtifactId());
        Assert.assertEquals(version, dependency.getVersion());
        Assert.assertEquals(packaging, dependency.getPackaging());
        Assert.assertEquals(classifier, dependency.getClassifier());
        final Set<MavenDependencyExclusion> exclusions = dependency.getExclusions();
        Assert.assertEquals(2, exclusions.size());
        final Iterator<MavenDependencyExclusion> it = exclusions.iterator();
        final MavenDependencyExclusion roundtrip1 = it.next();
        Assert.assertTrue(exclusions.contains(roundtrip1));
        final MavenDependencyExclusion roundtrip2 = it.next();
        Assert.assertTrue(exclusions.contains(roundtrip2));
        Assert.assertEquals(groupId + ":" + artifactId + ":" + packaging.toString() + ":" + classifier + ":" + version
            + ":" + scope, dependency.toCanonicalForm());
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.impl.maven.coordinate.MavenDependencyImpl

    }

    @Test
    public void prohibitAddingExclusions() {
        final MavenCoordinate coordinate = this.createCoordinate();
        final MavenDependency dependency = new MavenDependencyImpl(coordinate, null, true);
        final MavenDependencyExclusion exclusion = new MavenDependencyExclusionImpl("g", "a");
        boolean gotExpectedException = false;
        try {
            dependency.getExclusions().add(exclusion);
        } catch (final UnsupportedOperationException uoe) {
            gotExpectedException = true;
        }
        Assert.assertTrue(gotExpectedException);
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.impl.maven.coordinate.MavenDependencyImpl

    @Test
    public void defaultScope() {
        final MavenCoordinate coordinate = this.createCoordinate();
        final boolean optional = true;
        final MavenDependency dependency = new MavenDependencyImpl(coordinate, null, optional);
        Assert.assertEquals(ScopeType.COMPILE, dependency.getScope());
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.impl.maven.coordinate.MavenDependencyImpl

        }

        // SHRINKRES-102 test-jar has special behavior
        if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion) && dependency.getPackaging().equals(PackagingType.JAR) && dependency.getClassifier().equals(PackagingType.TEST_JAR.getClassifier())) {
            MavenCoordinate coordinate = MavenCoordinates.createCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), PackagingType.TEST_JAR, PackagingType.TEST_JAR.getClassifier());
            MavenDependency newDependency = new MavenDependencyImpl(coordinate, dependency.getScope(), dependency.isOptional(), dependency.getExclusions().toArray(new MavenDependencyExclusion[0]));

            // version is ignored here, so we have to iterate to get the dependency we are looking for
            if (session.getDependencyManagement().contains(newDependency)) {

                // get the dependency from internal dependencyManagement
                MavenDependency resolved = null;
                Iterator<MavenDependency> it = session.getDependencyManagement().iterator();
                while (it.hasNext()) {
                    resolved = it.next();
                    if (resolved.equals(newDependency)) {
                        break;
                    }
                }
                // we have resolved a version from dependency management
                resolvedVersion = resolved.getVersion();
                log.log(Level.FINE, "Resolved version {0} from the POM file for the artifact {1} via {2}", new Object[] {
                        resolved.getVersion(), dependency.toCanonicalForm() , newDependency.toCanonicalForm()});

            }
        }

        // Still unresolved?
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.