• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ScopeDependencyFilter类的典型用法和代码示例

java 1次浏览

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

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

示例1: collectDependencyArtifacts

点赞 3

import org.eclipse.aether.util.filter.ScopeDependencyFilter; //导入依赖的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: getBundleDependencies

点赞 3

import org.eclipse.aether.util.filter.ScopeDependencyFilter; //导入依赖的package包/类
public Set<BundleArtifact> getBundleDependencies(String... scopes)
		throws MojoExecutionException {
	ScopeDependencyFilter scopeFilter = new ScopeDependencyFilter(Arrays.asList(scopes), null);

	DefaultDependencyResolutionRequest dependencyResolutionRequest = new DefaultDependencyResolutionRequest(
			project, repositorySystemSession);
	dependencyResolutionRequest.setResolutionFilter(scopeFilter);

	DependencyResolutionResult dependencyResolutionResult;
	try {
		dependencyResolutionResult = projectDependenciesResolver
				.resolve(dependencyResolutionRequest);
	} catch (DependencyResolutionException ex) {
		throw new MojoExecutionException(ex.getMessage(), ex);
	}

	DependencyNode dependencyGraph = dependencyResolutionResult.getDependencyGraph();
	if (dependencyGraph != null) {
		checkBundleDependencies(dependencyGraph.getChildren());
		return getBundleArtifacts(dependencyGraph.getChildren());
	} else {
		return new HashSet<BundleArtifact>();
	}
}
 

开发者ID:apache,
项目名称:incubator-taverna-osgi,
代码行数:25,
代码来源:MavenOsgiUtils.java

示例3: copyDependencies

点赞 3

import org.eclipse.aether.util.filter.ScopeDependencyFilter; //导入依赖的package包/类
private Set<String> copyDependencies(File destination) throws DependencyResolutionException, IOException {
    Set<String> artifactNames = new HashSet<String>();
    for (Dependency dependency : project.getDependencies()) {
        if (!excludedScopes().contains(dependency.getScope())) {
            String depString = dependency.getGroupId() + ":" + dependency.getArtifactId()
                    + ":" + dependency.getVersion();

            CollectRequest request = new CollectRequest(
                    new org.eclipse.aether.graph.Dependency(
                            new DefaultArtifact(depString), dependency.getScope()), projectRepos);

            DependencyResult result = repoSystem.resolveDependencies(
                    repoSession,
                    new DependencyRequest(request, new ScopeDependencyFilter(null, excludedScopes())));

            for (ArtifactResult artifactResult : result.getArtifactResults()) {
                File artifactFile = artifactResult.getArtifact().getFile();
                File codeFile = new File(destination, artifactFile.getName());
                FileUtils.copyFile(artifactFile, codeFile);
                artifactNames.add(artifactFile.getName());
            }
        }
    }
    return artifactNames;
}
 

开发者ID:Falken224,
项目名称:getdown-maven-plugin,
代码行数:26,
代码来源:GenerateGetdownPackage.java

示例4: newRuntimeContext

点赞 2

import org.eclipse.aether.util.filter.ScopeDependencyFilter; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * <p>The bundle corresponding to the first bundle identifier will be used as the root dependency when creating
 * the {@link org.eclipse.aether.collection.CollectRequest} that will be passed to the Eclipse Aether library. That
 * is, the first bundle will (among other things) determine the dependency management performed by Aether
 * ({@code <dependencyManagement>} sections in a Maven POM file).
 */
@Override
public CompletableFuture<RuntimeContext> newRuntimeContext(List<URI> bundleIdentifiers) {
    Objects.requireNonNull(bundleIdentifiers);
    final ImmutableList<URI> localBundleIdentifiers = ImmutableList.copyOf(bundleIdentifiers);

    CompletionStage<RuntimeContext> completionStage = Futures.supplyAsync(() -> {
        List<Artifact> unresolvedArtifacts = localBundleIdentifiers
            .stream()
            .flatMap(this::artifactStreamFromURI)
            .collect(Collectors.toList());

        List<Artifact> bundleArtifacts = aetherConnector.resolveArtifacts(
            AndDependencyFilter.newInstance(
                new ScopeDependencyFilter(Arrays.asList(JavaScopes.COMPILE, JavaScopes.RUNTIME), null),
                this::shouldIncludeDependencyNode
            ),
            unresolvedArtifacts,
            JavaScopes.RUNTIME
        );

        XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
        List<MutableBundle> bundles = new ArrayList<>(bundleArtifacts.size());
        for (Artifact bundleArtifact : bundleArtifacts) {
            if (Bundles.ARTIFACT_TYPE.equals(bundleArtifact.getExtension())) {
                bundles.add(Bundles.loadBundle(jaxbContext, xmlInputFactory, bundleArtifact));
            }
        }

        return runtimeContext(bundleArtifacts, bundles);
    }, executor);
    return Futures.translateException(
        completionStage,
        throwable -> new RuntimeStateProvisionException(String.format(
            "Failed to provide runtime state for bundles %s.", bundleIdentifiers
        ), Futures.unwrapCompletionException(throwable))
    );
}
 

开发者ID:cloudkeeper-project,
项目名称:cloudkeeper,
代码行数:46,
代码来源:MavenRuntimeContextFactory.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)