当前位置: 首页>>代码示例>>Java>>正文


Java PreorderNodeListGenerator类代码示例

本文整理汇总了Java中org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator的典型用法代码示例。如果您正苦于以下问题:Java PreorderNodeListGenerator类的具体用法?Java PreorderNodeListGenerator怎么用?Java PreorderNodeListGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PreorderNodeListGenerator类属于org.eclipse.aether.util.graph.visitor包,在下文中一共展示了PreorderNodeListGenerator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectDependencyArtifacts

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
private List<Artifact> collectDependencyArtifacts(List<Dependency> dependencies)
        throws RepositoryException {
    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setDependencies(dependencies);
    DependencyNode node = repositorySystem
        .collectDependencies(repositorySystemSession, collectRequest)
        .getRoot();

    DependencyRequest dependencyRequest = new DependencyRequest();
    dependencyRequest.setRoot(node);
    // setFilter() allows null arguments.
    dependencyRequest.setFilter(
        AndDependencyFilter.newInstance(
            new ScopeDependencyFilter(Arrays.asList(JavaScopes.COMPILE, JavaScopes.RUNTIME), null),
            CloudKeeperBundleFilter.INSTANCE
        )
    );
    repositorySystem.resolveDependencies(repositorySystemSession, dependencyRequest);

    PreorderNodeListGenerator nodeListGenerator = new PreorderNodeListGenerator();
    node.accept(nodeListGenerator);
    return nodeListGenerator.getArtifacts(false);
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:24,代码来源:DummyAetherRepository.java

示例2: getAllDependencies

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
private ImmutableSet<ArtifactCoordinates> getAllDependencies(Artifact artifact, String scope)
		throws DependencyCollectionException, DependencyResolutionException {
	Dependency artifactAsDependency = new Dependency(artifact, scope);
	CollectRequest collectRequest = new CollectRequest(artifactAsDependency, singletonList(mavenCentral));
	DependencyNode dependencyRoot =
			repositorySystem.collectDependencies(repositorySystemSession, collectRequest).getRoot();

	DependencyRequest dependencyRequest = new DependencyRequest(dependencyRoot, null);
	repositorySystem.resolveDependencies(repositorySystemSession, dependencyRequest);

	PreorderNodeListGenerator dependencies = new PreorderNodeListGenerator();
	dependencyRoot.getChildren().forEach(node -> node.accept(dependencies));

	ImmutableSet.Builder<ArtifactCoordinates> dependencyCoordinates = ImmutableSet.builder();
	dependencies.getArtifacts(true).stream().map(ArtifactCoordinates::from).forEach(dependencyCoordinates::add);
	return dependencyCoordinates.build();
}
 
开发者ID:CodeFX-org,项目名称:jdeps-wall-of-shame,代码行数:18,代码来源:MavenCentral.java

示例3: transitiveDependencies

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
public static Set<Artifact> transitiveDependencies(Artifact artifact) {

    RepositorySystem system = newRepositorySystem();

    RepositorySystemSession session = newRepositorySystemSession(system);

    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setRoot(new Dependency(artifact, ""));
    collectRequest.setRepositories(repositories());

    CollectResult collectResult = null;
    try {
      collectResult = system.collectDependencies(session, collectRequest);
    } catch (DependencyCollectionException e) {
      throw new RuntimeException(e);
    }

    PreorderNodeListGenerator visitor = new PreorderNodeListGenerator();
    collectResult.getRoot().accept(visitor);

    return ImmutableSet.copyOf(
      visitor.getNodes().stream()
        .filter(d -> !d.getDependency().isOptional())
        .map(DependencyNode::getArtifact)
        .collect(Collectors.toList()));
  }
 
开发者ID:pgr0ss,项目名称:bazel-deps,代码行数:27,代码来源:Maven.java

示例4: fetchPage

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
public Page<Artifact, Artifact> fetchPage(DependencyResult dependencyResult, boolean includeUnresolved) {
	PreorderNodeListGenerator nodeListGenerator = new PreorderNodeListGenerator();
	dependencyResult.getRoot().accept(nodeListGenerator);
	// remove root from elements, should only include dependencies, not
	// itself
	List<Artifact> elements = new ArrayList<>(nodeListGenerator.getArtifacts(includeUnresolved));
	Artifact root = dependencyResult.getRoot().getArtifact();
	elements.remove(root);
	return new Page<>(Optional.of(root), elements);
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:11,代码来源:Dependency.java

示例5: resolveArtifacts

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
/**
 * Returns a filtered list of artifacts that the given (unresolved) artifact has as dependencies.
 *
 * <p>The first artifact is converted into the root dependency that is passed to
 * {@link CollectRequest#CollectRequest(Dependency, List, List)}. The root dependency is used, among other things,
 * to determine the managed dependencies. In other words, {@code unresolvedArtifacts} should not be treated as set,
 * the order (and in particular, which element comes first) is significant.
 *
 * @param dependencyFilter filter for nodes in the dependency graph; may be null
 * @param unresolvedArtifacts the artifacts that should be resolved, including their version-managed and merged
 *     transitive dependencies
 * @param scope Scope of root node in the dependency graph. If {@code dependencyFilter} filters on the scope, then
 *     this should match the requested scope. Otherwise, this parameter will not have an effect. May be
 *     {@code null}.
 * @return List of artifacts that the given (unresolved) artifact has as dependencies. The list only contains the
 *     artifacts of {@link DependencyNode} instances for that {@code dependencyFilter} returns {@code true}.
 *     Note that the returned list is inclusive of {@code unresolvedArtifact}.
 * @throws NullPointerException if {@code unresolvedArtifact} is {@code null}
 * @throws RepositoryException if one or more artifacts cannot be resolved
 */
public List<Artifact> resolveArtifacts(@Nullable DependencyFilter dependencyFilter,
        List<Artifact> unresolvedArtifacts, @Nullable String scope) throws RepositoryException {
    List<Dependency> dependencies = unresolvedArtifacts.stream()
        .map(unresolved -> new Dependency(unresolved, scope))
        .collect(Collectors.toList());

    if (dependencies.isEmpty()) {
        return Collections.emptyList();
    }

    CollectRequest collectRequest
        = new CollectRequest(dependencies.get(0), dependencies.subList(1, dependencies.size()), remoteRepositories);
    DependencyNode node = repositorySystem
        .collectDependencies(repositorySystemSession, collectRequest)
        .getRoot();

    DependencyRequest dependencyRequest = new DependencyRequest();
    dependencyRequest.setRoot(node);
    // setFilter() allows null arguments.
    dependencyRequest.setFilter(dependencyFilter);
    repositorySystem.resolveDependencies(repositorySystemSession, dependencyRequest);

    PreorderNodeListGenerator nodeListGenerator = new PreorderNodeListGenerator();
    node.accept(nodeListGenerator);
    return nodeListGenerator.getArtifacts(false);
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:47,代码来源:AetherConnector.java

示例6: resolveAll

import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator; //导入依赖的package包/类
@Override
public Set<ArtifactSpec> resolveAll(Set<ArtifactSpec> specs) throws Exception {
    if (specs.isEmpty()) {

        return specs;
    }

    final CollectRequest request = new CollectRequest();
    request.setRepositories(this.remoteRepositories);

    specs.forEach(spec -> request
            .addDependency(new Dependency(new DefaultArtifact(spec.groupId(),
                    spec.artifactId(),
                    spec.classifier(),
                    spec.type(),
                    spec.version()),
                    "compile")));

    CollectResult result = this.system.collectDependencies(this.session, request);

    PreorderNodeListGenerator gen = new PreorderNodeListGenerator();
    result.getRoot().accept(gen);

    return gen.getNodes().stream()
            .filter(node -> !"system".equals(node.getDependency().getScope()))
            .map(node -> {
                final Artifact artifact = node.getArtifact();

                return new ArtifactSpec(node.getDependency().getScope(),
                        artifact.getGroupId(),
                        artifact.getArtifactId(),
                        artifact.getVersion(),
                        artifact.getExtension(),
                        artifact.getClassifier(),
                        null);
            })
            .map(this::resolve)
            .filter(x -> x != null)
            .collect(Collectors.toSet());
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:41,代码来源:MavenArtifactResolvingHelper.java


注:本文中的org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。