Package org.jboss.shrinkwrap.resolver.api.maven.coordinate

Examples of org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependency


        ResolutionException, CoordinateParseException {
        if (canonicalForms == null) {
            throw new IllegalArgumentException("canonical forms must be provided");
        }
        for (final String canonicalForm : canonicalForms) {
            final MavenDependency dep = this.resolveDependency(canonicalForm);
            this.addDependency(dep);
        }
        return this.resolve();
    }
View Full Code Here


        }
        for (final String coordinate : coordinates) {
            if (coordinate == null || coordinate.length() == 0) {
                throw new IllegalArgumentException("null dependency not permitted");
            }
            final MavenDependency dependency = this.resolveDependency(coordinate);
            this.session.getDependenciesForResolution().add(dependency);
        }
        return this.covarientReturn();
    }
View Full Code Here

    }

    private MavenDependency resolveDependency(final String coordinate) {
        assert coordinate != null && coordinate.length() > 0 : "Coordinate is required";
        final MavenCoordinate newCoordinate = MavenCoordinates.createCoordinate(coordinate);
        final MavenDependency declared = MavenDependencies.createDependency(newCoordinate, null, false);
        final MavenDependency resolved = this.resolveDependency(declared);
        return resolved;
    }
View Full Code Here

    private MavenDependency resolveDependency(final MavenDependency declared) {
        final String resolvedVersion = this.resolveVersion(declared);
        final MavenCoordinate newCoordinate = MavenCoordinates.createCoordinate(declared.getGroupId(),
            declared.getArtifactId(), resolvedVersion, declared.getPackaging(), declared.getClassifier());
        final MavenDependency dependency = MavenDependencies.createDependency(newCoordinate, declared.getScope(),
            declared.isOptional(), declared.getExclusions().toArray(TYPESAFE_EXCLUSIONS_ARRAY));
        return dependency;
    }
View Full Code Here

        final MavenResolutionFilter postResolutionFilter = RestrictPomArtifactFilter.INSTANCE;
        final Collection<MavenResolvedArtifact> filteredArtifacts = new ArrayList<MavenResolvedArtifact>();
        final List<MavenDependency> emptyList = Collections.emptyList();

        for (final MavenResolvedArtifact artifact : artifactResults) {
            final MavenDependency dependency = MavenDependencies.createDependency(artifact.getCoordinate(),
                    ScopeType.COMPILE, false);
            // Empty lists OK here because we know the RestrictPOM Filter doesn't consult them
            if (postResolutionFilter.accepts(dependency, emptyList, emptyList)) {
                filteredArtifacts.add(artifact);
            }
View Full Code Here

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

                // get the dependency from internal dependencyManagement
                MavenDependency resolved = null;
                Iterator<MavenDependency> it = session.getDependencyManagement().iterator();
                while (it.hasNext()) {
                    resolved = it.next();
                    if (resolved.equals(dependency)) {
                        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}", new Object[] {
                        resolved.getVersion(), dependency.toCanonicalForm() });

            }

        }

        // 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

        }

        final Set<MavenDependency> bannedDependencies = new HashSet<MavenDependency>(coordinates.length);
        for (final String coords : coordinates) {
            final MavenCoordinate coordinate = MavenCoordinates.createCoordinate(coords);
            final MavenDependency dependency = MavenDependencies.createDependency(coordinate, ScopeType.COMPILE, false);
            bannedDependencies.add(dependency);
        }
        this.bannedDependencies = Collections.unmodifiableSet(bannedDependencies);
        this.rejectTransitives = rejectTransitives;
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependency

Copyright © 2018 www.massapicom. 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.